Redactor Examples
Catch Upload Errors

You need to return a value error to trigger error callback.


<script type="text/javascript">
$(function()
{
    $('#redactor').redactor({
        focus: true,
        imageUpload: 'upload-with-errors.php',
        callbacks: {
            imageUploadError: function(json)
            {
                alert(json.error);
                alert(json.anothermessage);
            }
        }
    });
});
</script>
 
<textarea id="redactor" name="content">...</textarea>

// And upload-with-errors.php script must return json:
{ 
    "error": "Hi! It's error message", 
    "anothermessage": "And another message." 
}