Jump to content

Upload multiple images but send them separately


GuitarGod

Recommended Posts

Hi all,

 

I'm currently using jQuery to upload multiple images, however, sometimes we're uploading 50+ images and each image is copied/resized to a thumbnail on upload, so we're breaching out max execution time among other things. Is it possible to alter jQuery to send each image individually thus keeping within our execution time and allowing us to track progress on each individual upload.

 

So far we have:

$( document ).on( 'submit', 'form[name="upload"]', function() {

            var data = new FormData( this );



            $.ajax({

                  type : 'POST',

                  url : 'upload.php',

                  async : false,

                  cache : false,

                  contentType : false,

                  processData : false,

                  data : data,

                  success : function( response ) {

                        alert( response );

                  }

            });

            

            return false;

      });

HTML is pretty much:

<form name="upload" enctype="multipart/form-data">

<input type="file" id="file_upload" name="file_upload[]" multiple><br>
<input type="submit" value="Upload"></form>

Any help would be appreciated.

 

Cheers!

Link to comment
Share on other sites

You could just alter the execution time: figure out how long a single image should take and multiply that by the number of images (then add a bit more just in case), change the time limit accordingly, and do your work.

 

Processing multiple images at once will be a bit faster than each one individually, though I wouldn't expect there to be that huge of a difference.

Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.