You need to return a value error to trigger error callback.
<script type="text/javascript">
$(document).ready(
function()
{
$('#redactor').redactor({
focus: true,
imageUpload: '/tests/upload_with_errors.php',
imageUploadErrorCallback: callback
});
}
);
function callback(obj, json)
{
alert(json.error);
alert(json.anothermessage);
}
</script>
The upload script returns JSON:
{
"error": "Hi! It's error message",
"anothermessage": "And another message."
}