Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Client Side validation for checking the file size using javascript before sending request to server

 
Ravi Saluru
Greenhorn
Posts: 11
Java MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have a requirement to check the file size which is being uploaded before sending the file to the server for the validation. The maximum file limit set is 10 MB for the upload, beyond which it is not to be allowed.

I tried couple of things,

For Firefox and Chrome -
var file = document.getElementById(idName).files[0];
file.size returns the correct size. But unfortunately this doesn't work with the IE(Sometimes I hate IE).

I tried to Google any solution for the IE Browser, some people suggested to use ActiveX, but sadly I can't use it.

Any solution for browser independent javascript solution ?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once.
 
    Bookmark Topic Watch Topic
  • New Topic