You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Java Programmer <jp...@gmail.com> on 2008/05/08 10:13:37 UTC

Problem with MultiFileUploadField and keeping rest of fields in model

Hello,
I have use MultiFileUploadField for uploading pictures, everything
works fine but when I use e.g. setMaxSize(Bytes.kilobytes(1024)) on
the form and try to upload larger picture or pictures than limit, I
got only one message about hitting limit size, and other fildes are
not checked this time (e.g. required text fields). There is also
problem with backuping fields from model after such sending, some
fields are set up, and some remains empty. I have read about "Notice
that this component clears its model at the end of the request, so the
uploaded files MUST be processed within the request they were
uploaded.", but I don't think it's the problem. I try to use 2 models
one CompoundPropertyModel for texts on form, and one for new
MultiFileUploadField(UPLOADS, new Model(new ArrayList<FileUpload>()),
MAX_PICTURES_TO_UPLOAD); (earlier I had everything in
CompoundPropertyModel).

Anybody knows what could be wrong?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with MultiFileUploadField and keeping rest of fields in model

Posted by Gerolf Seitz <ge...@gmail.com>.
when the file size exceeds the size limit,
the request processing is kind of "aborted" and the other
request params are not processed (no conversion, validation, ...).
when the page is then rendered again, the formcomponents
don't have an input value set, and that's why the fields
are cleared and no error messages are displayed.

there's already a jira issue for that, but actually there's not much
that we can do, except some hacks that would temporarily allow
an unlimited file size to be able to read the normal request parameters,
and just discard the uploaded files.
but then a (wicke[dt]) user can upload gigabytes of files and keeping
your server, connection, ... busy. so that's not really a solution either.

creative input on how to handle this is very much appreciated ;)

Cheers,
  Gerolf

On Thu, May 8, 2008 at 10:13 AM, Java Programmer <jp...@gmail.com>
wrote:

> Hello,
> I have use MultiFileUploadField for uploading pictures, everything
> works fine but when I use e.g. setMaxSize(Bytes.kilobytes(1024)) on
> the form and try to upload larger picture or pictures than limit, I
> got only one message about hitting limit size, and other fildes are
> not checked this time (e.g. required text fields). There is also
> problem with backuping fields from model after such sending, some
> fields are set up, and some remains empty. I have read about "Notice
> that this component clears its model at the end of the request, so the
> uploaded files MUST be processed within the request they were
> uploaded.", but I don't think it's the problem. I try to use 2 models
> one CompoundPropertyModel for texts on form, and one for new
> MultiFileUploadField(UPLOADS, new Model(new ArrayList<FileUpload>()),
> MAX_PICTURES_TO_UPLOAD); (earlier I had everything in
> CompoundPropertyModel).
>
> Anybody knows what could be wrong?
>
> Best regards,
> Adr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>