accept constraint for file inputs
#1150
transparent-citizen
started this conversation in
General
Replies: 1 comment 2 replies
-
|
Makes sense to me. The current implementation doesn't rely on It will be fairly easy to hook this up once we figure out how to best derive it:
Interested in giving it a try? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
File inputs can take an
acceptattribute to filter the filesystem dialog. It allows a comma-separated list of file type specifiers. These can either be a file extension (.png) or a MIME type (image/png).As of zod v4, native file support is available through z.file. It doesn't seem to support file extensions, but there is support for MIME types through
z.file().mime().Given a
z.file(), you can read the array of MIME types like this:It would be useful to have this data available in
metadatafor setting theacceptattribute for a file input based on the schema.Beta Was this translation helpful? Give feedback.
All reactions