You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefan Groschupf <sg...@media-style.com> on 2004/08/21 11:14:26 UTC

multi file upload

Hi,

I'm searching for a solution to have a multi file upload page. Since it 
is not possible to load a set of file with one forms, I'm searching for 
the best workaround.
My scenario;
I have a html-form and the user can fill out a set of html form fields, 
e.g. Name, Address etc.
I wish to to have in the same form a "browser file" button and a 
"upload this file"  button and I  wish to see the file listings in the 
form then with a checkbox if the file should really assign to the 
relation.
In case a user had provide the  name and address he can upload a set 
(n) of files before he finally submit the complete form.
In the db i have a customer 1:n file relation.

My questions are:
Is there a smart way to store more then one FormFile in the form bean?
I was searching a long time in the net to find a sample may how it can 
work work with a ArrayList ?
Where to temporally store the files content? May writing them to 
session is no good idea? May cache the file in a temp folder?
How to handle the multiple files in the action?  Do I need to process 
the file every time or is it done by struts and I only need to iterate 
over the arraylist of formfiles?

Thanks for any hints, since i really was searching for a solution but 
didnt find something in the mailarchive or within google.
A pointer to a cvs where where I can learn by reading code it welcome 
was well.

Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: multi file upload

Posted by struts lover <st...@yahoo.com>.
My implementation is slightly different. I created an
object of FileData with fields like formfile,filename
etc. When you first paint the jsp, your action class
would create a FileData object and put it into the
arraylist defined in your action form. 
I have a button called ADD ANOTHER FILE. When you
click it, you add another FileData object to that
arraylist.
When the user clicks the final submit button at the
bottom, the form gets submitted with all the data and
the arraylist of files.




--- Stefan Groschupf <sg...@media-style.com> wrote:

> > I have done the same thing.
> 
> I would be interested how you had realize the
> ActionForm getter and 
> setter. You handle the files  every time a user
> press the "load up this 
> file" button?
> 
> Thank you very much!
> 
> Stefan
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: multi file upload

Posted by Stefan Groschupf <sg...@media-style.com>.
> I have done the same thing.

I would be interested how you had realize the ActionForm getter and 
setter. You handle the files  every time a user press the "load up this 
file" button?

Thank you very much!

Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: multi file upload

Posted by struts lover <st...@yahoo.com>.
Hi,
I have done the same thing. I have an arraylist of
formfile objects. I keep it in session. If you dont
want to keep it in session, you might keep it in some
temp folder on the server. But I would suggest to keep
in the session, and after you complete your
transaction, clean up the session. You can have a
super action class, which cleans up the session before
any action takes place.





--- Stefan Groschupf <sg...@media-style.com> wrote:

> Hi,
> 
> I'm searching for a solution to have a multi file
> upload page. Since it 
> is not possible to load a set of file with one
> forms, I'm searching for 
> the best workaround.
> My scenario;
> I have a html-form and the user can fill out a set
> of html form fields, 
> e.g. Name, Address etc.
> I wish to to have in the same form a "browser file"
> button and a 
> "upload this file"  button and I  wish to see the
> file listings in the 
> form then with a checkbox if the file should really
> assign to the 
> relation.
> In case a user had provide the  name and address he
> can upload a set 
> (n) of files before he finally submit the complete
> form.
> In the db i have a customer 1:n file relation.
> 
> My questions are:
> Is there a smart way to store more then one FormFile
> in the form bean?
> I was searching a long time in the net to find a
> sample may how it can 
> work work with a ArrayList ?
> Where to temporally store the files content? May
> writing them to 
> session is no good idea? May cache the file in a
> temp folder?
> How to handle the multiple files in the action?  Do
> I need to process 
> the file every time or is it done by struts and I
> only need to iterate 
> over the arraylist of formfiles?
> 
> Thanks for any hints, since i really was searching
> for a solution but 
> didnt find something in the mailarchive or within
> google.
> A pointer to a cvs where where I can learn by
> reading code it welcome 
> was well.
> 
> Stefan
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org