File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Interrupting big file uploads to save traffic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Interrupting big file uploads to save traffic" Watch "Interrupting big file uploads to save traffic" New topic
Author

Interrupting big file uploads to save traffic

Pushker Chaubey
Ranch Hand

Joined: Dec 06, 2006
Posts: 53
Hi Experts,

When a huge file is uploaded, then is the request object available (and service invoked) only after the whole request body is materialized on server memory?

My problem is Whenever a huge file is uploaded I want to stop the upload as soon as I reach a limit of 20MB, thus avoiding the unnecessary traffic wastage.

I was thinking about checking for contentLength to find out the file size, but that will of no use if file has already been materialized on the server memory.

Any pointers on this are welcome!

Thanks and regards,
Pushker Chaubey
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
I guess if you had some kind of client side widget, such as an applet, to make the users upload with, that could do a check before hand and enforce maximum file size before uploading.

Error: Keyboard not attached. Press F1 to continue.
Pushker Chaubey
Ranch Hand

Joined: Dec 06, 2006
Posts: 53
No. I just have plain html on the client side.

But I still wondering how is it possible to check the file size at client side using any applet code or javascript.

Thanks,
Pushker Chaubey
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Interrupting big file uploads to save traffic