users@glassfish.java.net

Re: Discard large file upload

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 18 May 2009 10:47:35 -0700

On 05/18/09 05:01 AM, Sanganak-Guru wrote:
> Hi,
>
> I am working on a piece of code related to file upload using struts.
>
> I want to abort/discard a file upload request from browser in case the file
> size being uploaded is larger than what is currently configured.
>
> Is there any way to discard / abort file upload request and show user an
> error in case the file size is larger than configured file size upload
> limit?
>

In earlier GlassFish releases, you would specify the max file-upload size
via the maxPostSize property of <http-listener> (default: 4096).

The upcoming Servlet 3.0 spec, which is implemented by GlassFish v3, adds
server-side support for file-upload, and allows you to specify
(declaratively
via the new <multipart-config>, or via the new MultipartConfig annotation)
////////////configuration for multipart/form-data requests, including
the maximum size
of uploaded files and the maximum (total) size of multipart/form-data
requests.
This configuration may be specified on a per-servlet basis (for the
servlet(s)
handling multipart/form-data requests).

Thanks,

Jan


> Thanks in advance,
> -SG
>