The problem occurs only in IE<=9. Everywhere else fileupload works perfectly.
I'm using PrimeFaces version: 3.4.2. Upgrading to 4.0 doesn't change anything.
I've copied code from: PrimeFaces FileUpload demo
<h:form>
<p:fileUpload fileUploadListener="#{fileUploadBean.listener}"
mode="advanced" update="messages" auto="true" sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
<p:growl id="messages" showDetail="true" />
</h:form>
I've even defined:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
On my page it's not working but on FileUpload demo page it's suprisingly working.
I've noticed this strange behaviour on IE <= 9 (Content-Length is 0 and Content-Type is not present - why?):
But on PrimeFaces page there is (the same browser - IE8/9):
I've also tried to set enctype
to multipart/form-data
and (like on PrimeFaces demo page) application/x-www-form-urlencoded
(which is default)
What can I do to get this to work?
I've just resolved it.
The reason why it didn't work was that in the layout - XHTML masterpage there were included jquery and jquery.fileupload... but why IE<=9 didn't handle that I don't know (no errors/warnings in the console).
I just modified it to that below:
<o:conditionalComment if="gt IE 9">
<script src="#{request.contextPath}/js/jquery.min.js"></script>
<script src="#{request.contextPath}/js/jquery-ui.min.js"></script>
<script src="#{request.contextPath}/js/jquery.fileupload.js"></script>
</o:conditionalComment>
Now it works.