Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294882

Make a check of file size a baked-in client side validation

$
0
0

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

Reference: https://www.drupal.org/core/beta-changes
Issue categoryFeature request because it is new functionality
Issue priorityNormal because it only enhances efficiency and UX
Unfrozen changesFrozen because it is a feature and would require additional JavaScript and php logic

Viewing all articles
Browse latest Browse all 294882

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>