Trying to implement the JSF 2.2 example I have the following code:
<h:form prependId="false" enctype="multipart/form-data">
<!-- Now it's the AJAX file upload component -->
<h:inputFile id="fileUpload" value="#{someBean.file}" >
<f:ajax />
</h:inputFile>
<h:commandButton value="Upload" />
</h:form>
According to some JSF 2.2 this should work but in my case it is giving me the following error:
the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
Looking into the request although I have set my form enctype correctly, the partial request submits:
Content-type:application/x-www-form-urlencoded;charset=UTF-8 Faces-Request:partial/ajax
Note that web.xml also was modified to:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<multipart-config>
<location>c:\dotmp</location>
<max-file-size>20848820</max-file-size>
<max-request-size>418018841</max-request-size>
<file-size-threshold>1048576</file-size-threshold>
</multipart-config>
</servlet>
I am using Mojarra 2.2.0-m15 but tried this with earlier versions as well. Does anyone know any useful info about this issue, which I assume is a bug?