title: How can I trigger the error event in DropZone using PHP?
body: <p>In dropzone.js , there is an event <code>error</code>, however I can not find any documentation on how to trigger this from PHP.</p>
  
  <p>I have tried sending various header() responses from PHP including, 404, 500, 503, and so on yet this event has not fired.</p>
  
  <p>What I am looking to do, is the server checks the mime to see if it is valid, and if it is not valid, I discard the file, and ideally -- return an error so that dropzone can respond accordingly.</p>
  
  <p>From the javascript side, I have tried the following :</p>
  
  <pre><code>.on("complete", function(file,response) {
     console.log(response);
  }
  
  .on("error", function(file,response) {
     console.log(response);
  }
  
  .on("success", function(file,response) {
     console.log(response);
  }
  </code></pre>
  
  <p>... however, <code>response</code> is undefined, even if i return JSON or plain text from the php script.  It doesn't appear that dropzone.js supports getting the full server response or at least it doesn't elevate it to the custom handler.  The ONLY place I have seen any reference to passing a second param on events is here on SO in other questions that are not directly asking this question.</p>
  
  <p>There must be a way to get the server response (as I have done in the past with other uploader javascript such as jQuery POST, and jqUpload, and so on).  It seems rather silly that I can't trigger a command to signal the upload failed -- even if the file transfer completed -- as it still needs to wait on the script for a response. --- This means I am likely overlooking something, which is why I am calling for assistance as their documentation reveals absolutely nothing with regards to how a server should respond --- language irrelevant, however in my case, I am using PHP.</p>
  
  <p>Thanks in advance.</p>