upload multiple files in struts using <html:file> tags

Hi Guys,

I have a jsp with multiple <html:file name="image" property="imageFiles" styleClass="long"/> tags which submit to a form bean property <form-property name="imageFiles" type="org.apache.struts.upload.FormFile[]"/>

When I submit my page I get the error:

[06/07/05 19:02:48:503 BST] 71ab7dff WebGroup      E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile' to property 'imageFiles' of type '[Lorg.apache.struts.upload.FormFile;'
      at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:423)
      at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java(Compiled Code))

I have tried defining the form bean property as a Collection, and get a similar ConversionException.

FYI my form is defined as <html:form action="/image/save" focus="title" enctype="multipart/form-data">.

Struts framework must be able to handle a multiple FormFile submit?! But my googling has uncovered nothing....

Any suggestions ASAP please :)

Thanks in advance,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


From my past experiences, I think that it is not possible. The thing that you can do is to add more than one FormFile and you have to get it separately so there is no something like FormFile[]


I did a search on the struts user thread and seems that this a bug.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
inqchickAuthor Commented:
Thanks guys for your help.... your answers are as I suspected. I had to revert back to having a form-bean property for each FormFile this morning. Glad to see you found that apache have this "feature" logged :)

Cheers and beers

PS - hope everyone in london are ok, and staying safe
Glad I could help.

>>"PS - hope everyone in london are ok, and staying safe"
I hope so

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.