Hi, how can I restrict the size of a file being uploaded, before it gets
uploaded?

The following code does not work, since wicket first uploads the file to the
server, THEN checks its size (I've tried it uploading a 1Gig file):

       protected void onSubmit() {

            final FileUpload upload = fileUploadField.getFileUpload();

            if (upload != null) {
             if(upload.getSize() > Bytes.kilobytes(150).bytes()) {
             return;
             }
}
}


I've also tried setting the form's maxSize like so, but the file still seems
to get uploaded:
setMaxSize(Bytes.kilobytes(150));

Anyone run into this same problem? Thanks.

Reply via email to