How to push FileList to the previous variable

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

  1. $( '#total' ).bind( 'dragover',function(event) {              
  2.        event.stopPropagation();
  3.       event.preventDefault();   
  4.   });
  5. $( '#total' ).bind( 'drop',function(event) {
  6.        event.stopPropagation();
  7.       event.preventDefault();
  8.  if( upfiles_new == 0 )
  9.  {
  10.       upfiles_new = event.originalEvent.dataTransfer.files;
  11.       console.dir(upfiles_new);
  12.       upfiles = Array.prototype.slice.call(upfiles_new, 0);
  13. }
  14. else
  15. {
  16.        upfiles_temp = event.originalEvent.dataTransfer.files;
  17.       var upfiles = $.merge( upfiles_new,upfiles_temp);
  18.        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
  19.       upfiles = Array.prototype.slice.call(upfiles, 0); // but in this array it is not showing
  20. }
  21. $( "#fileToUpload" ).trigger( 'change' );
  22. });
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