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

feat: Add file validation for specific file extensions, mimes or both. #65

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AbrahamX3
Copy link

Description

This PR adds file type validation using sonner toast errors and fixes #36 (comment)

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.

Preview

chrome_63pZR7XbtY.mp4

Copy link

vercel bot commented Nov 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
quickpic ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2024 3:03am

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

Successfully merging this pull request may close these issues.

1 participant