Upload files with formData

0

I try to upload images (using drag & drop) using Ajax but I run into the following error just when I try to send the files to a function:

TypeError: 'append' called on an object that does not implement interface FormData.

The code I am using is this: $("#listaImagenes").bind("drop",function(e){ e.preventDefault(); var files = e.originalEvent.dataTransfer.files; for (var i = 0; i < files.length; i++){ var fd = new FormData(); fd.append("file", files[i]);
subidaFicheros(fd); //al hacer esta llamada es donde me falla } });

And the function raisedFiles () what it does is simply a call to an ajax.php file such that:

$.ajax({ url:"ajax/ajax.php", type:"post", data:{accion:"subirimg",ficheros:formData}, success:function(data){ console.log("fin"); } });

As soon as I make the call to that function, it is when the console launches the error ... where can I get the error?

    
asked by Marcos 04.09.2018 в 10:50
source

0 answers