We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Check if image respect dimension before submitting it

Hello all,

I want to allow user to upload image with  requirement dimensions (215*115) at minimum. I'm aware that there is the a method ClientSideOnFileSelect. If the file is less than the required , i stop the upload.

Please let me know if you have such scenario. May be i have to use FileReader in that method.

Best regards

1 Reply

AP Arun Palaniyandi Syncfusion Team March 11, 2016 03:12 PM UTC

Hi Leks,

Thanks for contacting Syncfusion support.

Query :” I want to allow user to upload image with  requirement dimensions (215*115) at minimum. I'm aware that there is the a method ClientSideOnFileSelect. If the file is less than the required , i stop the upload.Please let me know if you have such scenario. May be i have to use FileReader in that method.”

 

In Uploadbox, we can restrict the file upload by its dimension using the FileReader in the ClientSideOnFileSelect event as you said. This FileReader function gets the image’s url and through this we can able to get the image dimensions to set the condition to restrict the file upload. If the condition is satisfied an alert message is displayed to show the error and after that the page is reloaded to stop showing the Uploadbox dialog in image onload function. Hence we have prepared a sample by using this FileReader in the ClientSideOnFileSelect event.

 

Please find the sample below:
http://www.syncfusion.com/downloads/support/forum/123348/ze/sample-1027259730
 

Please let us know if you need further assistance.

Regards,
Arun P


Loader.
Live Chat Icon For mobile
Up arrow icon