简体   繁体   中英

jquery file upload send all files in one post

I am using jquery file upload. I use it for several pages in a project. For one project I need to upload all the files in one request because I loop trough all the images and after that, a dossier is created and closed. I think it's faster to send all the images at once instead of changing the server side handler. Only thing is, I can't get them together. I founded the option singleFileUploads, this works, but only if you select all the files at once. If drag and drop 2 times, it still uploads in 2 posts (and it makes 2 dossiers.

I have read the documentation ( https://github.com/blueimp/jQuery-File-Upload ), but can't find out how to get it work. (i know that this is a plugin specially made for multiple posts)

So basically my question is, does anyone know how to get the inserted files before uploading so i can group them and serialize them.

Thnx,

This post might help you:

Multiple File Upload Input

Unfortunately, it does not support IE. But there is still a Flash-based plugin (free) can do that, of course it also supports multi browsers.

Check it out: Demos - Uploadify

You can upload your files during form submit.

 var submitFormData = true;  
$('#fileFieldId').fileupload({
   dataType : 'json',
   autoUpload : false,
   add : function(e, imageData){
      $("#yourFormId").on("subimt",function(){
          if(sendData){
              imageData.formData = $("#yourFormId").serializeArray();              
              submitFormData = false;
          }

          imageData.submit();
      });
   },
   done: function(e,data){
       submitFormData = true;
   }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM