Limiting oversized image uploads - any nice solutions?


(Douglas (@finnatic at @waikato)) #1

We have our Max File Upload set high to allow the uploading of large documents (PDF, video, audio) etc.

This has the undesirable consequence of allowing distributed web authors who don’t know better to upload images that haven’t been optimised for the web.

Are there any nice solutions that we could consider to highlight the problem at the upload of the image (either via _admin or Edit+) that others have and would like to share?

I’d consider a squiz map idea to have max filesize variable per filetype, but aren’t sure if that’s an easy idea or a hard one, and something we could deploy sooner would be grand.


Asset Listings/Triggers - sorting / selecting by asset size?
(Bart Banda) #2

File-size restriction by asset type sounds like a good feature request, definitely put it into squizmap.

As a workaround, you could either restrict some authors to only be able to upload certain sizes using group preferences (which may not be applicable), or alternatively, write an Edit+ plugin that checks the file size before upload using JS and the HTML 5 file api and removes it from the upload file field with a custom error message if it’s too big.

The third option might be to use a trigger somehow to check after asset created and then maybe delete it? But not sure if that would work nicely in edit+.


(Douglas (@finnatic at @waikato)) #3

Idea 10674 - Max File Upload variable by asset type created.

Group preferences may be worth investigating quickly, and the Edit+ plugin sounds like an option to explore.