You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by shubu <c4...@yahoo.com> on 2006/02/14 15:23:19 UTC
Re: Multiple File Upload using Struts (number of files dynamic)
Prasad, Kamakshya <kprasad <at> capitalservicing.co.jp> writes:
>
> Hi,
>
> In the form bean keep an array list of FormFile and use it similarly as
> dynamic list control.
>
> KP
>
> -----Original Message-----
> From: Viral_Thakkar [mailto:Viral_Thakkar <at> infosys.com]
> Sent: Thursday, July 08, 2004 3:01 PM
> To: Struts Users Mailing List
> Cc: Ketan_Bhat
> Subject: Multiple File Upload using Struts (number of files dynamic)
>
> Hi,
>
> We are trying to implement uploading file via struts framework using
> form bean. According to our requirement we have two scenarios' in which
> we require uploading of our file.
> 1) Uploading single file (single html:file control and a single
> upload button in jsp page)
> 2) Uploading multiple files (Multiple html:file controls on the
> screen on the same form).
> The problem is that these number of html:file controls on the screen is
> not fixed, it is dynamic. The user can click on an "Add More" button to
> increase dynamically the number of files he/she wants to upload.
>
> We have implemented the first scenario by using html:file tag on the JSP
> and keeping a form bean with html control as one of its member
> variables. In the action class we extract the value from the bean and
> then upload the file using I/O streams.
>
> Now, for the second scenario we need to upload an indeterminate
> (determined at run time) number of files but at the same time the number
> of members in the bean class cannot be changed dynamically.
>
> So we either need a way to add members to a form bean dynamically or
> some other mechanism which will handle this multiple upload requirement.
>
> With Regards,
> Viral
>
how can I mak the list of FormFile in the form bean I tried implementing it but
got an exception of type mismatch
I did somthin lik this
private FormFile theFiles[];
public FormFile[] getTheFiles() {
return theFiles;
}
/**
* @param theFiles The FormFile to set.
*/
public void setTheFiles(FormFile[] theFiles) {
this.theFiles = theFiles;
}
how can I do it
plz reply soon, waiting......
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org