File Type Validation Service

134 Views Asked by At

It is necessary to store uploaded files on a different server to the web app if you deploy with Heroku. I've had a look through some of their add-ons in the market place and many seem good for storage and delivery like Cloudinary and Filestack (although the latter is too expensive for testing with so I'm favouring Cloudinary). Moreover they provide out of the box image transformations which reduces the work my own server would have to do potentially. As for security I think I'm right in saying the file size restrictions they provide are reliable. The only concern I'm left with therefore is properly validating the file is indeed an image - my use case - or more generally the right file type. Cloudinary does have a file type restriction but I think this just checks the extension and doesn't actually validate the file content. It seems silly to have to upload the image to my heroku server first to check this before it gets sent to the storage service provider. Does anybody know of such a service?

1

There are 1 best solutions below

0
On

Cloudinary performs the actual content validation and not just the extension check. You can test changing a file extension and uploading it to see if it fails. I changed the extension of jpg to png and to a doc and both of them uploaded as jpg to Cloudinary.