Skip to Content
0
May 10, 2010 at 11:07 AM

How to limit file size for FileUpload UI element?

231 Views

Hi all,

I'm using the FileUpload UI element in NW2004s SP20.

I want to limit the size of the uploaded file.

The simple option is to load the file to the context, check the size, by using

InputStream stream = resource.read(false);
double size = stream.available();

and report errors if any.

However, I don't want to store huge files in the context or flie system (even temporarily) nor 'spend' network resources for uploading a file that I won't be use...

Is there a way to limit the file size by using some property for the fileUpload UI element in the server?

Is there a way to check the file size before it's uploaded (for example like GMAIL does - checks the file BEFORE the actual upload)

Regards,

Omri