Problem/Motivation
Drupal's managed_file
form #type allows files of any size to be sent to the server. A server-size limit exists, but the user is not informed of the issue until waiting for the possibly large file to be uploaded. Testing a file's size on the client prior to upload is totally doable in the majority of browsers currently in use, and it is possible to gracefully skip this check, falling back to the current behavior, on IE 8 and 9.
Proposed resolution
Make the following changes:
- Determine the maximum allowed size for a given managed_file form element, including as configured on file field widgets, and include this amount as a data- attribute of the file input.
- Add javascript to compare the size of files to this attribute, and prevent form submission if appropriate.
User interface changes
This implies a new validation error, originating in JavaScript, may be presented to the user. Its details would need to be worked out.
API changes
None anticipated
Data model changes
None anticipated
Beta phase evaluation
Issue category | Feature request because it is new functionality |
---|---|
Issue priority | Normal because it only enhances efficiency and UX |
Unfrozen changes | Frozen because it is a feature and would require additional JavaScript and php logic |