wood burning stoves*
The moose likes Servlets and the fly likes problem with restricting size of uploading file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with restricting size of uploading file" Watch "problem with restricting size of uploading file" New topic
Author

problem with restricting size of uploading file

Ravi Kumarasinghe
Greenhorn

Joined: Apr 08, 2002
Posts: 12
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

Joined: May 17, 2001
Posts: 2823
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
 
subject: problem with restricting size of uploading file