File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 61601
    
  67

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