I want to upload some files to my server with a drag'n'drop angularjs directive. I've hardcoded for hours but I haven't still found the error. I have that angularjs code:
var fd = new FormData();
for(x = 0; x < files.length; x++)
fd.append("file[]", files[x]);
fd.append('type', 'upload');
xhr = new XMLHttpRequest();
xhr.open("post", "/../RESOURCES/API/explorer.php", true);
xhr.upload.addEventListener("progress", function(e) {
var pc = parseInt(100 - (e.loaded / e.total * 100));
console.log(pc);
}, false);
xhr.onload = function() {
console.log(xhr.responseText);
};
xhr.send(fd);
But my APIs returns empty $_POST and $_FILES. Thanks!