Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
7.1.2
-
Unknown
-
Description
The HTML5 FileUploader has an option autoUpload (default true):
Should the upload start as soon as the files are selected, or wait for a submit event?
Setting this option to false does not appear to change the behaviour. If the widget appears in a form that contains a submit button the widget begins to upload as soon as a file is selected. Also, any other content from other input fields within the form (such as the file_label field below) is not included in the submission.
Example content
{{velocity}}
{{html}}
<form action="ProcessFile" method="post" enctype="multipart/form-data">
<input type="text" placeholder="label" name="file_label" />
<input type="file" class="fileUploadWidget" name="newfile" />
<button type="submit">Upload</button>
</form>
{{/html}}
{{/velocity}}
Javascript for page
document.observe('dom:loaded', function(){ $$('input.fileUploadWidget').each(function(item){ var fu = new XWiki.FileUploader(item, { autoUpload: false, progressAutohide: true, responseURL: '' }); }); });