wood burning stoves 2.0
The moose likes Struts and the fly likes problem with file upload in a JSF form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with file upload in a JSF form " Watch "problem with file upload in a JSF form " New topic

problem with file upload in a JSF form

Ioan Berciu

Joined: Nov 17, 2002
Posts: 15
Hi all!

In a JSF form i have this code fragment.

<f:verbatim >
<input name="importFile" type="file" size="10">
</f:verbatim >

To upload the selected file I use commons-fileupload-1.0.jar from tomcat's 5.0 server dir.

I get this exception:

the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded

JSF forms dont allow the attribute encType to be set.
I tried this and the hole aplication dont work.

Does any one know a solution for this problem?

Thanks in advance.

James Holmes
Ranch Hand

Joined: Jan 06, 2004
Posts: 64
Hi Berciu,

I recommend you look into using MyFaces (http://www.myfaces.org/). MyFaces has a component for file uploads.

JSF Resources and Console GUI tool
wood burning stoves
subject: problem with file upload in a JSF form