jquery plugins - Parallel uploads for multiple images using DropzoneJS -
at present have working dropzonejs implementation user can select multiple images , upload them. there parameter paralleluploads seems in practice determine how many images can uploaded @ once, example when select files dialog opened if user selects 10 files, paralleluploads:5
first 5 images upload , remaining 5 ignored, , 5 images sent via single http post request.
what able configure there no limit how many images uploaded, uploaded in batches. example, if user selects 30 images, them uploaded successfully, either 1 image per http post request or defined number per http post such 5. if set paralleluploads:30
server requires vast amount of memory try , server-side processing on 30 images in 1 go , doesn't seem great solution.
how can configure launch separate http post request per image or defined number of images @ once without capping number of images being uploaded in 1 action user?
<link rel="stylesheet" type="text/css" href="dropzone.css" media="all" /> <script type="text/javascript" src="dropzone.min.js"></script> <div id="pnlphotothumbnails"></div> <div class="clearfix"> <form id="frmupload" method="post" enctype="multipart/form-data" action="photo-upload.json" class="dropzone"> <input type="file" name="photo" id="photo" /> </form> </div> <style type="text/css"> #frmupload input[type=file]{display:block;height:0;width:0;} </style> <script type="text/javascript"> function refreshphotos(){ $('pnlphotothumbnails').load('photo-thumbnails.php'); } $(function(){ $('frmupload').dropzone({ acceptedfiles: '.jpg', paralleluploads: 5, init:function(){ var hdropzone = this; this.on('success', function(){ refreshphotos(); hdropzone.removeallfiles(); }); } }); }); </script>
note: above example code similar implementation have, though i've edited make question general rather specific project, , sufficient code give idea of how works bear in mind not complete , functional snippet! photo-upload.json server-side script process file upload , return json succcess/error response, photo-thumbnails.php return html <img/>
tags each of photo thumbnails.
it turns out following configuration solve this, when in specific case allow 100 files uploaded in 1 user action, individual http post request each image upload.
as of dropzonejs version 4.0, not appear possible (correct me if i'm wrong) set number of files allowed uploaded in 1 go unlimited, or define number of images batch together, either uploaded or uploaded separately:
paralleluploads: 100, uploadmultiple: false
Comments
Post a Comment