0

I have a file upload field in my form.I want to get the file dimensions in the front end while uploading before sending to server side.I need to restrict the width and height of the image to 400 x 232 pixels before it is uploaded to the uploads folder.How is it possible to restrict/check the file width and file height purely from the extjs side?

user3363475
  • 21
  • 1
  • 5
  • possible duplicate of [How to Preview Image, get file size, image height and width before upload?](http://stackoverflow.com/questions/12570834/how-to-preview-image-get-file-size-image-height-and-width-before-upload) – Alexander Oct 15 '14 at 08:19
  • but in the above said question only validation via javascriptjquery is possible.How to meet the same requirement in uploading image files using extjs fileupload field – user3363475 Oct 15 '14 at 09:24

1 Answers1

0

If you are using fileupload component,then inside the Fileup.js,go to the onButtonTap function.Here after the below line(in ready case) you can apply your own validation.

var file = me.fileElement.dom.file[0];

Above line gives you an object of file,you can apply console.log(file),to check the content,i think it returns size also, and then you can apply your own validation rule.

dReAmEr
  • 6,986
  • 7
  • 36
  • 63