uploadthing icon indicating copy to clipboard operation
uploadthing copied to clipboard

feat: Showing image preview of selected file before uploading

Open growupanand opened this issue 1 year ago โ€ข 6 comments

Describe the feature you'd like to request

Currently, I am using UploadDropzone to handle the whole image upload flow. I can show a preview of the image by using the generated image URL. But if I want to show an image preview or do something with the selected file before even clicking on the upload button, there is no way I can access the selected file.

Describe the solution you'd like to see

There should be an option in the configuration like onFileSelect, where I can pass a callback function to get access to the selected file.

<UploadDropzone
      onFileSelect={(selectedFile)=>{
        // here i can access the selected file
      }}
    />

Additional information

No response

๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributing

  • [X] ๐Ÿ™‹โ€โ™‚๏ธ Yes, I'd be down to file a PR implementing this feature!

growupanand avatar May 13 '24 10:05 growupanand

yea I think we should expose the onDrop prop publically

juliusmarminge avatar May 13 '24 12:05 juliusmarminge

Can I try to work on this issue?

growupanand avatar May 13 '24 14:05 growupanand

Sure!

juliusmarminge avatar May 13 '24 15:05 juliusmarminge

can you please assign this issue to me?

growupanand avatar May 13 '24 15:05 growupanand

Just work on it and submit a draft PR when you got something to show others you're working on it

juliusmarminge avatar May 13 '24 17:05 juliusmarminge

Can you please check my PR? - https://github.com/pingdotgg/uploadthing/pull/809#issuecomment-2110778736

growupanand avatar May 15 '24 09:05 growupanand