I use dropzone.js to upload files to a server. The server then responds with a file id and new filename for deleting purpose.
I found this solution.
Deleting renamed file on server using Dropzone.js
But when I use the uploadMultiple:true
option, it sends multiple files in
a single request. So I get the same response in all success callbacks, how can I receive the appropriate JSON response in each individual success callback?
Dropzone.options.dropzone1 = {
paramName: "file",
uploadMultiple:true,
success: function( file, response ) {
//this callback will run twice
console.log(response) //same response in each callback
}
}
$ret = array();
array_push($ret,array('id' => $id1,'filename' => $newfilename1));
array_push($ret,array('id' => $id2,'filename' => $newfilename2));
echo json_encode($ret);