wood burning stoves 2.0*
The moose likes Struts and the fly likes Uploading Multiple Files Using html:file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Uploading Multiple Files Using html:file" Watch "Uploading Multiple Files Using html:file" New topic
Author

Uploading Multiple Files Using html:file

Vijay RamaRaju
Greenhorn

Joined: Feb 27, 2006
Posts: 7
Hi All.,

I am working with Struts and i ran into a problem while trying to upload multiple files using struts tags.

<logic:iterate ....>
<html:file property="formFile" indexed="true"/>
<html:button property="Upload" indexed="true"/>

</logic:iterate>


and in formBean

private FormFile formFile=null;

public FormFile getFormFile(){
return this.formFile;
}

public void setFormFile(FormFile formFile){
this.formFile = formFile;
}


for example the generated response has 10 browse buttons for uploading files., when i upload some file in the 10th "Browse" then its accepting a for all the remaining browse(textbox) buttons., nothing is getting uploaded into server,Infact its taking null values. The main problem is that i am unable to find an accurate mapping in as formBean property for the jsp defined UI control.


Help me out.

Thanks
Vijay
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I have written a dozen or so pages that used indexed properties, but each time I have to look through the Struts documentation or use the previous code as an example. Do you really want to use an indexed property here?

If so I would expect your bean to contain an array or List of FormFile objects and that you would have methods like this:


- Brent
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
Hi Brent,
Is there a need to user indexed property if I have to use form files array?
There will be multiple files uploaded that has same property name in struts form and unknown number of files to be uploaded. Is there any examples available to refer the same situation?

Thanks
Deepa
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uploading Multiple Files Using html:file
 
Similar Threads
Struts.. file upload array
Upload multiple files with separate submit buttons
File upload with websphere 6. file object is stripped.
How can I upload multiple files using html:file
file upload within logic:iterate