Better handling of max upload filesize

Permalink 0 0 Browser Info Environment
TL;DR:

It would be nice if the File Manager UI warned you before you try to upload a file larger than PHP's maximum settings, post_max_filesize and upload_max_filesize.

At the moment the AJAX upload continues all the way to the end, then comes back with an error like "Uploaded file is too large. The current value of post_max_filesize is 5M". This isn't very user friendly.


Background:

A few weeks back our website went down catastrophically while I was on holiday. Long story short, somebody had uploaded a large image, and PHP/Concrete5 were running out of memory trying to resize it for thumbnails. It seemed that in some fail case, the thumbnail was attempting to be recreated every time anyone loaded a page, and would thus keep on failing indefinitely. I've since discovered we were running 8.2.1, and there were some updates which have potentially fixed this issue - several things in the changelogs suggest changes in this area.

Curious to see if the issue was fixed, I attempted to replicate it today and couldn't (hooray!) but noticed that the UI could be improved a little here.


Status: New
mlocati replied on at Permalink Reply
mlocati
Are you aware tht there's an option to automatically downsize images that are too big? This settings is located in the Dashboard -> System & Settings > Files > Image Uploading.
The current concrete5 version requires that this downsizing is performed on the server side (that is, users will send the huge image to the server).
With the next concrete5 version, this downsize operation will be performed on the client size (provided that users use a modern browser), so there will no need to show a file size limit.
danielgwood replied on at Permalink Reply
I'm aware of the option yes, though in this case it would probably not be a good thing - what I'm seeking to prevent is users uploading far-too-large images (and killing my application) in the first place. Part of that is user education (a photo on the web need not be 20 MB), part of that is handling it when they do it anyway.

Client-side resizing in the next version of C5 does sound like it would help in some cases, though in mine I frequently encounter older browsers and terrible internet connections - the organisation is based in Madagascar.
mlocati replied on at Permalink Reply
mlocati
I don't think that users should be educated when using technology. Technology is there to make human's life easier, not the opposite.
This obviously can't always happen (like in this specific case when users use older browsers).
In such cases, BTW, concrete5 will resize the received images on the server side.
danielgwood replied on at Permalink Reply
Whether or not you think I should educate my CMS authors is beside the point. I don't disagree with your philosophy regarding technology, but if I didn't train my authors at all it would be...interesting...to see what happened.

What I'm asking for is to prevent or warn users if they try to upload a too-large image. When you consider that uploading a 20MB image may take over an hour on some connections (yes, even in 2018), only to get an error message that it was too large to begin with, I have wasted my users time.

If that isn't possible, fair enough.

concrete5 Environment Information

# concrete5 Version
Core Version - 8.3.2
Version Installed - 8.3.2
Database Version - 20180122213656

# concrete5 Packages
n/a

# concrete5 Overrides
blocks/external_form/form/controller/contact_form.php, blocks/external_form/form/controller, blocks/external_form/form/contact_form.php, blocks/external_form/form, blocks/external_form

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.6.33

# PHP Extensions
bcmath, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, ionCube Loader, json, ldap, libxml, mailparse, mbstring, mcrypt, memcache, mhash, mssql, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 128M
post_max_size - 5M
sql.safe_mode - Off
upload_max_filesize - 5M
ldap.max_links - Unlimited
memcache.max_failover_attempts - 20
mssql.max_links - Unlimited
mssql.max_persistent - Unlimited
mssql.max_procs - Unlimited
mssql.textlimit - Server default
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3355.4 Safari/537.36