Restrict File Upload Size in Registration Form 'File' fields

I posted this question on the IRC but with all the spam going on I think it was swamped out :frowning:

When someone uses a registration form field of type “File”, some people who fill in the form attempt to upload a file that is larger than the settings in the web server (SSLRengeBuffer, even if it is set very generous. This results in a Server Error or similar when the "Submit button is clicked, which does not tell them what went wrong or always allow the registrant to go back and edit their registration.

We have added some guideline text into the field telling registrants the maximum size of a file, however, is there a way to have the code behind the field detect the file size before the “Submit” button is clicked and the registration fails?


We have an application-wide config setting:

It doesn’t apply to the Registration Form only, though.

Also, I don’t think we have any client-side checks that prevent the user from starting the upload in the first place.

Yes, we have Apache settings that limit upload but they only apply after the upload has been attempted and has returned an error for the user/registrant, which is too late :frowning:

ThiefMaster: You have correctly restated the problem I was originally trying to raise: warning or stopping the file BEFORE the upload and associated error occurs.

When an image is uploaded in the ‘Customisation -> Images’ section, this warning does occur, although it seems to be using a limit set by a different parameter (server-side?) that I haven’t found yet.

Can we implement the upload limiting in the ‘Images’ management for the ‘File’ section that can be added to the the registration forms?

Theoretically, yes. But I’m not sure how much work that is. We’d have to use a dropzone widget in the registration form, which we currently don’t.