Experimental project
This is a sandbox project, which contains experimental code for developer use only.
This module adds an alternative to the standard core-provided *bar* (with pecl uploadprogress) upload progress widget with new XHR2 upload monitoring support in browsers via xhr.upload.progress.
Note: This is an API module and is targeted towards module developers.
Pitfalls:
- The beforeSend function had to be overriden from core to add support for setting up XHR uploadprogress (see xhr2_uploadprogress.js)
- It might not work (NOT TESTED) on older browsers like IE 8, 9 etc.
How to use
1. Install the module as usually: https://www.drupal.org/node/895232
2. In your form class, you configure the field #type as xhr2_managed_file, example:
$form['files'] = [
'#type' => 'xhr2_managed_file',
'#title' => t('Add files'),
'#progress_indicator' => 'xhr2',
'#required' => true,
'#multiple' => true,
'#upload_validators' => ['file_validate_extensions' => [$field_definition->getSetting('file_extensions')]],
'#weight' => 3,
];
```
When you upload files, the system should display a progress bar that tracks the form submission progress.
Supported also by Holcim România.
Supporting organizations:
Supported development
Project information
- Project categories: Developer tools, Media
- Created by cristiroma on , updated
