Skip to content

File upload error message improvements

Sam Sehnert requested to merge custom/features/am_upload_errors into custom/art_money

Task

https://preview.gotasman.com/task/detail/43563

What I did

  • Improve error messages to include max size.
  • Added a method to get the max upload size
  • Add a method to parse the size from php ini

Setup

None

Testing

(Easiest to test this in conjunction with the MR for the above Art Money task)

  • Take note of your site's file upload size as set in PHP config files (post_max_size and upload_max_filesize , whichever is smallest)
  • Attempt to upload a file via DF_Files class, which is larger than the PHP config size.
  • Observe an error returned by the DF_Files class
  • Ensure a properly sized file will upload correctly

It's not really worth testing the MAX_FILE_SIZE case, as this isn't even supported by browsers, shouldn't be relied on, and is pretty much irrelevant. Only there for completeness.

Merge request reports