Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Validate file size before uploading to server  RSS feed

 
poli reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

In JSP, I want to restrict the size of file being uploaded.

I've <input type="file" name="myfile"/> in my jsp.

If the size of file more than a specific size say 5MB, i want to give mesage to the user. I don't want to wait till the file gets uploaded to server and then validate the file size. I need client side validation. Can it be done using scripting language or any other way?

I need a solution for this in Internet Explorer. I got a solution using ActiveX control:


But ActiveX controls not allowed in our application . Is there any alternative way for this?

Please suggest me approaches.. Thanks!!

-------
Poli reddy
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An Applet perhaps?
 
poli reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear Bibeault.. I've used applets and it worked.

jFileUpload solved this issue:
http://www.jfileupload.com/products/jfileupload/ => download link
http://jupload.sourceforge.net/howto-customization.html => documentation
* http://www.jfileupload.com/products/jfileupload/documentation/configuration_http.html => config params

maxsize- This parameter identify the maximum size of the uploaded file. It prevents the user to upload too big files.

thanks to the forum for suggestions..!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!