I'm trying to send an json-array to the upload.php file. The following error popped up:
Uncaught TypeError: Illegal invocation
I'v also tried to add processData: false
but then there's is nothing posted to upload.php.
My code: http://jsfiddle.net/r0330537/86yqj/
HTML
<div id="dropzone" class="dropzone">
Drop uw bestanden en/of zip hier
</div>
JQUERY
$( document ).ready( function() {
...
function drop(event) {
//console.log( "drop", event );
event.stopPropagation();
event.preventDefault();
$(this).removeClass("dragging");
var data = event.dataTransfer,
fileList = data.files,
file = new Array();
for(i = 0; i < fileList.length; i++) {
file.push( fileList[i] );
}
console.log( file );
// ajax
$.ajax({
type : "POST",
url : "ajax/upload.php",
dataType : "json",
data : { "file": file },
succes : function(data) {
console.log(data);
}
});
}
var dropzone = $( ".dropzone" ).get(0);
...
dropzone.addEventListener( "drop", drop, false );
});