Add client side validation for file size during file upload.
3 unresolved threads
3 unresolved threads
Closes #2533896
Merge request reports
Activity
Filter activity
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
added 1 commit
- e71ff0b9 - Use the '**' operator instead of 'Math.pow'.
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
- Resolved by Oleksandr Syvyi
27 27 $(once('fileValidate', $context.find(selector))).on( 28 28 'change.fileValidate', 29 29 { extensions: elements[selector] }, 30 Drupal.file.validateExtension, 146 * Client-side file input validation of file extensions. 146 * Client-side file input validation of file extensions and file size. 147 147 * 148 * @name Drupal.file.validateExtension 148 * @name Drupal.file.validateExtensionAndSize 149 149 * 150 150 * @param {jQuery.Event} event 151 151 * The event triggered. For example `change.fileValidate`. 152 152 */ 153 validateExtension(event) { 153 validateExtensionAndSize(event) { 154 154 event.preventDefault(); 155 const file = this.files[0]; 156 157 // Formats bytes to human friendly unit. 158 function humanFileSize(size) {
Please register or sign in to reply