Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13514

HTML5 File Uploader doesn't respect autoUpload option or submit other form data

    XMLWordPrintable

Details

    • 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: ''
          });
        });
      });
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            beldaz Bryn Jeffries
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: