struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Viral_Thakkar" <>
Subject Multiple File Upload using Struts (number of files dynamic)
Date Thu, 08 Jul 2004 06:01:01 GMT
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,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message