Filestack not limiting maximum file size for third party providers

858 Views Asked by At

I'm currently using Filestack V3, and the code snippet below gives a normal alert when a file larger than 2MB is uploaded from the local file system. However there is no error message when uploading from Google Drive for example.

fileStackClient.pick({
  accept: 'image/*',
  maxSize: 2097152, //Should limit to 2MB
  fromSources: ['local_file_system','facebook','googledrive','url','imagesearch', 'instagram'],
  storeTo: [...],
}).then(function() {

});  

So it's basically very easy for someone to break my site by uploading a 100MB image from google drive for example. Can you please fix?

1

There are 1 best solutions below

0
On

Not all cloud sources provide filesize before the upload begins. One way to add an extra check with images is to use the imageMax parameter and set crop.force = true. This will make it so that images are downsized on the client side prior to upload.