There is an error event in dropzone.js, however I cannot find any documentation on how to call this from PHP.
I tried to send various header () responses from PHP, including 404, 500, 503, etc., but this event was not fired.
What I want to do, the server checks the mime to see if it is valid, and if it is invalid, I drop the file and, ideally, return an error so that dropzone can respond accordingly.
From the javascript side, I tried the following:
.on("complete", function(file,response) { console.log(response); } .on("error", function(file,response) { console.log(response); } .on("success", function(file,response) { console.log(response); }
... however, the response is undefined, even if I return JSON or plain text from a PHP script. It doesn't seem like dropzone.js supports getting a full server response, or at least doesn't raise it to a user exit. ONLY the place where I saw any link to pass the second parameter to events is here on SO in other questions that do not directly ask this question.
There should be a way to get the server response (as it was in the past with another javascript loader like jQuery POST and jqUpload, etc.). It seems rather silly that I cannot call a command to signal that the download failed - even if the file transfer is complete - because the script still needs to wait for the response. --- This means that I probably donβt notice something, so I ask for help, since their documentation shows absolutely nothing about how the server should respond - the language does not matter, however in my case I use PHP .
Thanks in advance.
Kraang prime
source share