File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with restricting size of uploading file

 
Ravi Kumarasinghe
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a file uploading servlet. In that I need to limit the file size to 1MB. I can get the file size at the beginning using request.getContentLength().
Now I need to send output message to the client using the response.getWriter().println(message);
This command is getting executed, but the servlet is not sending the response until I read the whole file in the request body.
I need to avoid unnecessarily reading a large file. Is there a way to send a message to the client form the servlet initially without reading the whole uploaded file ?
I tried the 'Orielly' package also. THat is also having the same problem.
The 'jspsmart' sample program works but it seems that they are also reading the whole uploaded file before giving the error message.
Even Hotmail uploads the whole file blindly before giving the error message
BUT somehow yahoo mail does it. It give the file too large error very quickly without reading the whole file. SO there has to be a way.
Can anyone PLEASE help me
Thanks a lot
Ravi
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ravik
Welcome to the JavaRanch! Please adjust your display name to meet
the JavaRanch Naming Policy. You can change it here.
Thanks!
and welcome to the JavaRanch!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic