• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do i check the file size while uploading  RSS feed

 
Upendra Maheshwari
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai :
My self upendra maheshwari,i have an problem in cheking the file size while uploading through jsp ,i am using multipart request method for tht .can we check the file size with the help of java script ...so we can restrict to upload more than 5 mb size file...tell me .
Upendra Noida
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

As far as I know, it isn't possible to check the size of a file using plain old javascript (or access the file system in any way).

The only way to do this would be for whatever server process (e.g. servlet) is 'receiving' the file, to count the amount of data transferred, and terminate the connection when this amount exceeds 5Mb.

There are alternatives, for example having using some form of trusted client side code (signed applet or scripting of an activex object), however, the first option is likely to be far easier, unless you have a limited user base.

If you are interested in the second option (not recommended) readthis post on jguru

Hope this helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!