How to push FileList to the previous variable
hey guys...!
Im implementing jquery drag and drop file upload using ajax call to php
I have implemented it successfully but i need a little modification and for me it is big
When user drag and drop the multiple files im showing them up in a div containing id total .
Once the user drag and drop the multiple files for the second time im clearing them up, instead of clearing i need to merge the FileList to the previous files which are stored in a variable upfiles
Here is the basic code which i need to merge the FileList
- $( '#total' ).bind( 'dragover',function(event) {
- event.stopPropagation();
- event.preventDefault();
- });
- $( '#total' ).bind( 'drop',function(event) {
- event.stopPropagation();
- event.preventDefault();
- if( upfiles_new == 0 )
- {
- upfiles_new = event.originalEvent.dataTransfer.files;
- console.dir(upfiles_new);
- upfiles = Array.prototype.slice.call(upfiles_new, 0);
- }
- else
- {
- upfiles_temp = event.originalEvent.dataTransfer.files;
- var upfiles = $.merge( upfiles_new,upfiles_temp);
- console.dir(upfiles); // in console log it is showing in a merged and length is showing the // last dragged length instead of showing total merged length
- upfiles = Array.prototype.slice.call(upfiles, 0); // but in this array it is not showing
- }
- $( "#fileToUpload" ).trigger( 'change' );
- });
Here #fileToUpload is input file id
No where i didnt get the solution is it possible first of all... Please let me know....
Thanks in advance