How to pass my own error message back to browser?

I’d like to only allow image uploads for a classified ads site. I know how to check file types but I can’t figure out how to send an error message back to the browser if the file type is not an image. Can someone lend a hand?

Hi

You need to send state:false and your serevr message in ‘info’ attr, i.e:

if (uploaded_file_not_suitable_for_ads) { echo '{state: false, extra: {code: 1, text: "your file is not suitable for ads"}}'; }

and then on client side:

myVault.attachEvent("onUploadFail", function(file, extra){ dhtmlx.message("Error code "+extra.code+": "+extra.text); });

more docs docs.dhtmlx.com/api__dhtmlxvault … event.html