Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename file before upload #176

Open
NotMyUid opened this issue Nov 8, 2021 · 3 comments
Open

Rename file before upload #176

NotMyUid opened this issue Nov 8, 2021 · 3 comments

Comments

@NotMyUid
Copy link

NotMyUid commented Nov 8, 2021

Hello,
I'm trying to rename a file before uploading it. Is it possible?

I tried renaming "file.name" both in "getUploadParams" and in "onChangeStatus" function, but I noticed that it is a readonly field.

Code:
1

I also tried, in "getUploadParams", to modify the returned value including a new File with the modified name as a property of "fields" object: in this case, in the request there are two files instead of one.

Code:
2

Request:
3

Thank you so much!

@mariomurrent-softwaresolutions

@NotMyUid Did you solve this?

@NotMyUid
Copy link
Author

NotMyUid commented Dec 6, 2022

Hi @mariomurrent-softwaresolutions ,
Solved with the use of a work-around.. I post here the steps we followed in order to rename a file before it has been uploaded.

  1. Step one consists in disabling auto-upload (no-longer use "getUploadParams").
  2. Keep listening for status change, then create a copy of the original file, rename it, and store in a global variable.

Code:
0

  1. Create a method which uploads the new file to your destination.

Code:
1
2

  1. Add a button to your template in order to upload the image, on click event call the method you wrote at step 3.

Hope this helps, best regards :)

@NotMyUid NotMyUid closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
@NotMyUid NotMyUid reopened this Dec 6, 2022
@mariomurrent-softwaresolutions

@NotMyUid Yeah I found the same stuff. Thx for information. This works like a charm although its a bit hacky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants