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

FEATURE REQUEST: Allow client-side processing of files before uploading #39

Open
OneHatRepo opened this issue Jul 5, 2024 · 2 comments

Comments

@OneHatRepo
Copy link

OneHatRepo commented Jul 5, 2024

I'd like to be able to resize images on the client side before uploading them to the server. This would require some way to hook into the upload process.

I've tried Dropzone.onChange, but processing the images requires onChange to be an async handler, and it's currently not. i.e. If onChange returns a Promise, it would await that Promise before continuing on with the upload.

I've also tried the actionButtons / uploadButton with autoUpload = false. Using this prevents the automatic upload, and assigning an onClick handler to the uploadButton means I get to process the event, but I seem to have no way to initiate the upload once the processing is done. Is there a way to initiate the upload externally? That would solve the problem.

@Pooyahmti
Copy link
Contributor

Being able to do these requires you to edit the source code. for example I've implemented the custom upload button by passing a state to the dropzone component and using it inside a useEffect hook .

@OneHatRepo
Copy link
Author

@Pooyahmti I forked the repository and made a few tweaks to @files-ui/react/build/index.es.js, and that worked, but I'd rather have something actually built into the library. It seems like other people would like to be able to publicly access the uploadfiles() method of Dropzone.

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