File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes upload limit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "upload limit" Watch "upload limit" New topic

upload limit

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104


Recently I have made a servlet to upload files to my aplication.
I needed to define the maximun size to upload.

The problem is that the size of the file is not checked until the file is fully uploaded.

Now, I'm using apache.commons.fileupload

Is there any way to check the size when the file is uploading?

Thanks in advance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

I haven't tried this, so it's more of speculation than an answer.

There is a streaming API in commons. If you were reading the stream, you could track how much is uploaded. You wouldn't be able to give the user a nice message as you'd have to just stop uploading at that point. But you could counter that with AJAX to state the server gave up.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: upload limit
It's not a secret anymore!