Catch upload errors

This example shows how to catch the error response from the server for the image or file uploading.

    Demo

    Code

    <!--element -->
    <textarea id="content"></textarea>
    
    <!-- call -->
    <script>
    $R('#content', {
        imageUpload: '/your-image-upload-script/',
        fileUpload: '/your-file-upload-script/',
        callbacks: {
            image: {
                uploadError: function(response)
                {
                    console.log(response.message);
                }
            },
            file: {
                uploadError: function(response)
                {
                    console.log(response.message);
                }
            }
        }
    });
    </script>
    
    <!-- server response json -->
    {
        "error": true,
        "message": "Something went wrong..."
    }