javascript - How to upload more than 2 files by Dropzone.js with button -


i make simple form uploading files. form can add multiple files queue. special button can remove file queue. reason doesn't work in way want. clicking "unload files" 2 files uploading server. if click second time second 2 files uploading. code below. how upload files click button ones? in advance.

html:

<div class="panel panel-default">    <div class="panel-heading">       <strong>Прикрепить файлы</strong>    </div>    <div class="panel-body">       <button type="button" class="btn btn-primary" id="add-file">          <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span> Обзор...       </button>       <button type="button" class="btn btn-primary" id="upload-file">          <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span> Загрузить       </button>       <ul class="list-group dropzone-previews" style="margin-top: 10px; margin-bottom: 0;"></ul>    </div> </div> 

js:

$(".panel").dropzone({         url: "upload.php",         autoprocessqueue: false,         init: function() {         var mydropzone = this;             $('#upload-file').click(function() {                 mydropzone.processqueue();             });         },         clickable: '#add-file',         acceptedfiles: 'image/*,application/pdf,application/msword',         previewscontainer: '.dropzone-previews',         previewtemplate: '<li class="working list-group-item">' +             '<span data-dz-name></span> <span data-dz-size></span> (<u data-dz-remove>Удалить</u>)' +             '<div class="progress" style="margin-top: 10px; margin-bottom: 0;">' +             '<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" data-dz-uploadprogress></div>' +             '</div></li>'     }); 

and server script on php:

<?php $ds = directory_separator; $storefolder = 'uploads'; if (!empty($_files)) {    $tempfile = $_files['file']['tmp_name'];    $targetpath = dirname( __file__ ) . $ds. $storefolder . $ds;    $targetfile =  $targetpath. $_files['file']['name'];    move_uploaded_file($tempfile,$targetfile); } ?> 

just increase value of paralleluploads 10 or 20. default send 2 file @ time server, need increase value of paralleluploads , work.

 $(".panel").dropzone({             url: "upload.php",             autoprocessqueue: false,             init: function () {                 var mydropzone = this;              },             paralleluploads: 20,             clickable: '#add-file',             acceptedfiles: 'image/*,application/pdf,application/msword',             previewscontainer: '.dropzone-previews',             previewtemplate: '<li class="working list-group-item">' +                     '<span data-dz-name></span> <span data-dz-size></span> (<u data-dz-remove>Удалить</u>)' +                     '<div class="progress" style="margin-top: 10px; margin-bottom: 0;">' +                     '<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" data-dz-uploadprogress></div>' +                     '</div></li>'         });         $('#upload-file').click(function () {             mydropzone.processqueue();         }); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -