Dropzone.options.rhDropzone = { uploadMultiple: false, complete: function( file, response) { var xhrresponse = file.xhr.response; var resp = JSON.parse(xhrresponse); if( resp.success == true ){ toastr.success( file.name + ' has been added.') fileElement.classList.add("dz-complete"); }else{ toastr.error( 'Error:' + resp.msg); var fileElement = file.previewElement; fileElement.classList.add("dz-error"); var errorMessageElement = fileElement.querySelector(".dz-error-message"); if (errorMessageElement) { errorMessageElement.textContent = "Custom error message here"; } } Save }`
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter