jQuery-File-Upload (blueimp) – how do I access the error value both in JS end and PHP

How do I test if the file uploaded has returned an error using blueimps file uploader.

The uploader only allows a single file upload (must be an image).

I have the following js code


In the “done” function I’m trying to find out if there is a error so I can show the correct message to the user.

I’ve tried “alerting” out data.result[0].error and data.files[data.index].error but it either comes out blank or has a “data.result[0]” is undefined.

Mostly from this question here: blueImp/jquery file upload – How do I get the error message if the file type was not accepted?

also on the PHP side of things how do I check if there is an error. For example the PHP index file has this:

require('UploadHandler.php');
$upload_handler = new UploadHandler();

What do I need to figure out if there is an error so I do some processing on the server side?

Read more here: Source link