Slingshot S3 - allowedFileTypes

I am using the slingshot package to upload files to my app.
Uploading files is restricted to admin users.
I want it to be possible for them, to upload any type of file.


config provided:

Slingshot.fileRestrictions("myFileUploads", {
  allowedFileTypes: ["image/png", "image/jpeg", "image/gif"]

This configuration is required.

Does anyone know where to find a list of all possible inputs?
Or even better to allow all files?

1 Like

Looking at the the validators checkFileType() function it accepts a RegExp as well as a string (or array of strings), so…

allowedFileTypes: /.*/i

… will allow any files type through (just quickly tested on a Slingshot S3 setup I have here and it allows anything I threw at it through). If you want to limit to a subset of specific filetypes which is a better/safer idea, they’re called MIME types, and you can find lists all over, here is one that claims to be quite comprehensive.


Thank Mr.FireGoby :).

1 Like