danielm / uploader

A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
https://danielmg.org/demo/java-script/uploader
MIT License
1.17k stars 384 forks source link

Token headers not refresh on multiple uploads #75

Open ramoneariel opened 6 years ago

ramoneariel commented 6 years ago

I need to upload multiple files, but the headers are not refreshed, send the same for all

`<script type="text/javascript> var token = "string"; var auth = "string";

$("#drop-area").dmUploader({ url: '/upload-file', maxFileSize: 10000000, // 10M auto: false, queue: true, extraData: function() { return { "folder_id": inFolder }; }, headers: { 'X-CSRF-TOKEN': token, 'X-CSRF-AUTH': auth }, onDragEnter: function(){ this.addClass('blue inverted'); }, onDragLeave: function(){ this.removeClass('blue inverted'); }, onNewFile: function(id, file){ this.removeClass('blue inverted'); $("#added_files").show(); add_file(id, file); }, onUploadProgress: function(id, percent){ file_progress(id, percent); }, onUploadError: function(id, xhr, status, message){ swal("", message, "error"); }, onFallbackMode: function(){ swal("", "Error.", "error"); }, onFileSizeError: function(file){ swal("",".", "error"); }, onComplete: function(){ location.reload(); }, onUploadSuccess: function(id, data) { var d = $.parseJSON(dat); token = d.data.CSRF_TOKEN; auth = d.data.CSRF_AUTH; if(!data.status){ swal('', data.msg, 'error'); }

    }

});

`