Closed ghost closed 8 years ago
Can you post your code?
i want to use some variables created onSubmit event for each file, but last file overwrite everything set ie i need to show loading process for each file, by onProgress
var uploader = new ss.SimpleUpload({
debug: true,
button: 'btn-file-upload',
url: '{{ url.toRoute ('ajax/file-upload') }}',
name: 'file',
multiple: true,
multipart: true,
responseType: 'json',
allowedExtensions: ['jpg', 'jpeg', 'png'],
maxSize: 10240, // kilobytes
hoverClass: 'ui-state-hover',
focusClass: 'ui-state-focus',
disabledClass: 'ui-state-disabled',
onProgress: function (pct) {
// want to use it here
// file, div, progress
updateUploadedImage(this._opts.data);
console.log( this._opts.data ) ;
console.log( pct + '%');
},
onSubmit: function(filename, extension) {
this.setData ({
file: filename,
div: document.createElement('div'),
progress : document.createElement('div')
});
},
onComplete: function(filename, response) {
if (!response) {
alert(filename + ' upload failed');
return false;
}
console.log( this._opts.data ) ;
addUploadedImage(response);
console.log(filename + ' upload finished');
//console.log(this);
//console.log(response);
}
});
please advice on multiple concurrent file uploads setData dont work, no scope on Processs (pct) one param really?