I have posted my question on the Primefaces forum but no one has responded so I figured I would try here.
I have been attempting to get fileUpload to work for some time now. I am currently running the RC2 build with mojarra 2.0.3 and Tomcat 7.
I have a dialog which will contain the fileUpload component like so.
<p:dialog id="uploadFileDialog" >
<h:form id="uplaodFileForm" prependId="false" enctype="multipart/form-data">
<p:fileUpload fileUploadListener="#{fileUploadController.uploadFile} auto="true"/>
</h:form>
</p:dialog>
The fileUploadController looks like this
public class FileUploadController {
public void uploadFile(FileUploadEvent event) {
byte[] file = event.getFile().getContents();
System.out.println("MADE IT INTO FILE UPLOAD !!! ");
}
}
For some reason when the file is uploaded it never triggers the fileUploadEvent and it never gets into the controller. The upload looks like its working, the flash part renders and gives the impression its doing something but no backing bean is ever being called. I can seem to figure out what I am doing wrong and I have read just about every post on uploading a file using primefaces. Anyone know what I am doing wrong?
ViewExpiredException
in the server logs on every upload attempt. PF forums reports the same in several topics: "works on Tomcat 6, but not on Tomcat 7". Do you see anything in the server logs? – BalusC@nickname
to auto-notify them. See also meta.stackexchange.com/questions/43019/… As to myViewExpiredException
problem, it might be solved in 2.2 RC2. Haven't tried yet. Let me know if it works. – BalusCViewExpiredException
since I am using Glassfish, fileUploadEvent never fired in my case – Thang Pham