If the server returns an error (HTTP response code != 200) when uploading a file with Uploadify, the uploaded file gets a red background and a message is show like this:
Unfortunately the onUploadError event does not have access to the reponse body. You'll have to return 200 status and handle the errors in onUploadSuccess as far as I'm aware.
Here's how I'm doing it:
'onUploadSuccess' : function(file, data, response) {
var responseObj = JSON.parse(data);
if(responseObj.error_message)
{
$("#" + file.id).hide(); // this will hide the misleading "complete" message..
alert(responseObj.error_message);
return;
}
}
Or better yet you could replace the "complete" message with your error message like so:
'onUploadSuccess' : function(file, data, response) {
var responseObj = JSON.parse(data);
if(responseObj.error_message)
{
$("#" + file.id).find('.data').css('color', 'red').html(' - ' + responseObj.error_message);
return;
}
console.log(file, data, response);
}