Going through several refactors, I found in my opinion the best way to keep many things as unchanged as possible since from the looks of it, when uploading a file, it is handled in two instances, when dragging a file and when directly using the upload input.
This PR verifies if the file type is valid depending on what's given in acceptedFileTypes, it displays a custom message in case a tool supports only SVG's, any Images (if "image/*" wildcard is passed inside acceptedFileTypes), specific extensions or even if in the future a tool need's a specific format such as a transparent image (a .png for example), this PR makes it easy to verify a specific file mime, extension, or both.
Description
This PR adds file type validation using sonner toast errors and fixes https://github.com/t3dotgg/quickpic/pull/36#issuecomment-2467326103
Going through several refactors, I found in my opinion the best way to keep many things as unchanged as possible since from the looks of it, when uploading a file, it is handled in two instances, when dragging a file and when directly using the upload input.
This PR verifies if the file type is valid depending on what's given in
acceptedFileTypes
, it displays a custom message in case a tool supports only SVG's, any Images (if "image/*" wildcard is passed insideacceptedFileTypes
), specific extensions or even if in the future a tool need's a specific format such as a transparent image (a .png for example), this PR makes it easy to verify a specific file mime, extension, or both.Preview
https://github.com/user-attachments/assets/f672a8df-6a98-4aef-a1e1-ede5fb8885da