wood burning stoves 2.0*
The moose likes JSP and the fly likes Client Side validation for checking the file size using javascript before sending request to server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

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

Ravi Saluru
Greenhorn

Joined: Nov 01, 2011
Posts: 10

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


Thanks and Regards,
Ravi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Please do not post the same question more than once.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client Side validation for checking the file size using javascript before sending request to server