By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

how to validate input type file using javascript for file type and size?

P: 1
how to validate input type file using javascript for file type and size?
Oct 27 '13 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
not as easy as you might wish.

you have access to the file name through the input's value property, but there you can only check for the nominal extension (there is no guarantee that a .jpg file is actually a JPEG image, it could be just misnamed).

the file size you could get if your broser supports the FileReader API.
Oct 27 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.