fortana-co / react-dropzone-uploader

React file dropzone and uploader
https://react-dropzone-uploader.js.org/
MIT License
447 stars 183 forks source link

Custom uploadFile function #19

Open denistex opened 5 years ago

denistex commented 5 years ago

Hi guys and thanks for the great component!

I would like to ask if it is possible to add an ability to completely override the behavior of the uploadFile function? There is a quite complicated upload procedure in my current project; in fact, I use the @azure/storage-blob package to upload files to the cloud and it turns out that a single POST request made by react-dropzone-uploader is not enough to replace all the magic that happens inside the storage-blob package. :-)

Therefore it would be great to have a property for the custom uploadFile function that could be used to implement the specific logic of file uploading. It should be also possible to set the uploading progress and mark the file as successfully uploaded or not uploaded because of an error.

Again - thank you for the component! Best regards.

luc-plamondon commented 4 years ago

I have the same need because I use a GraphQL server, which requires a rather complicated request to upload files. I don't really have to build the request myself, the Mutation component from the apollo-react library does it for me, so I would like to override RDU's upload function with the one generated by my Mutation component.

rberger commented 4 years ago

We have a similar situation using aws amplify/storage AND aws Appsync in the upload process.

Have been able to work around it a bit, by not setting getUploadParams doing all the work in the onSubmit callback but I don't see anyway to hook in and set the progress bar in the RDU component from the onSubmit callback.

sepsol commented 3 years ago

@rberger Did you find any way to show the progress bar when calling onSubmit ?

rberger commented 3 years ago

@sepsol Its been a while. I think we created an independent widget that manages its own progress bar by monitoring some aspect of the upload. Unfortunately I don't have any simple snippets to share. Its all kind of engrained in our Clojurescript app...