File Type Filter for File Picker Component

It would be useful to have an option for the file picker to supply a pattern for allowed file types e.g.*.pdf so only pdf files can be uploaded.

Unless there is a way that I’m not seeing…

Glide is great btw… :upside_down_face:

2 Likes

Exactly that would be great.

I’ve also needed this feature!

Bob, I was thinking about this the other day but hasn’t tested it. Let’s say I upload a PDF file via a file picker, it should have the .pdf extension. Can we use a user-specific component and only show the submit button when the uploaded file contains “.pdf”?

1 Like

Hm…probably!

…but it couldn’t work IN a form, only before seeing a form button, right?

Yes, true. We can configure the action after the form submission now, but it wouldn’t stop Glide from writing a new row though. Have to make a “fake form” to do this.

Checking the file name is not enough. You have to take a look in the file to be sure what file type it is. https://en.m.wikipedia.org/wiki/Magic_number_(programming)

If you have to take a look in the file then it’s not an automatic process anymore. How do you expect this to work though?

1 Like

I can see making the extension something you look for. That would actually be easy enough to do in Glide. But checking for the actual file type that would have to be a Glide thing all the way. Something we couldn’t work around.

image

The choosen file types shoud be the file filter.

After the check a failed message “Wrong file format” woud be nice.

2 Likes

By the way the image picker has this filter, but I can change it to all files and upload a pdf as image.

Not in realtime, but you could write a script that would check the file type after it’s been uploaded and take action depending on what it finds. Not much use in this case, but it is possible :slightly_smiling_face: