This code snippet allows to drop multiple files dragged into a box. The filereader creates a blob of each file and then EACH file should be send to server using the ajax rq:
$.each( e.dataTransfer.files, function(index, file){
    var fileReader = new FileReader();
    //..generate BLOB from file 
    fileReader.onloadend = (function(file) {                                
        return function(e) {                            
            uploadfilelist.append('<li>' + file.fileName + '</li>');
            //send every single file to server
            var destfoldername=CURRENTPATH;
            var uploadfilename=file.fileName;
            var fd = new FormData();
            fd.append("param1", destfoldername);
            fd.append("param2", uploadfilename);
            fd.append("param3", blob);
            $.ajax({
                type:"POST",
                url:"url",
                data:fd,
                contentType: false,
                processData: false,             
                beforeSend:function (xhr){ 
                    //custom headers
                },  
                success: function(data, textStatus, jqXHR){
                },
                complete: function(jqXHR){    
                    alert("State after complete: " + jqXHR.statusText);                 
                }           
            });
        };
    })(file);
    fileReader.readAsBinaryString(file);
}
PROBLEM: the server internal crashes when receiving a next blob while not having processed the former one.
I found another Post discussing this: How to make all AJAX calls sequential? A "sequential" Request using async:false is not an option, it would block a whole lot of other things..
SOLUTION: ??? Call ajax forfile1, when call is done, call ajax for file2, ...call ajax for file-n
I would really like to use JQ Deferred (http://api.jquery.com/category/deferred-object/) e.g. as described here: http://api.jquery.com/jQuery.when/
$.when($.ajax(???how to refer to THIS ajax call).done(function(){
//call this ajax for the next file again or use $.ajax(code).then()?
});  
I am really sorry, but I do not know how to get it right.
Thanks for any suggestions! h.
 
     
     
    