I am using PF 3.0.RC1 / NetBeans 7.0.1 and when I try to set fileUploadListener for fileUpload component , NetBeans gives this warning "Unknown Property 'handleFileUpload' " at leftmost of line.
In debug mode when I use fileUpload , it don't call handleFileUpload method and nothing becomes.
What can I do for this problem ?
The code in the xhtml page :
<p:fileUpload fileUploadListener="#{BDS_System.handleFileUpload}" mode="advanced"
sizeLimit="500000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
The code in the managed bean :
public void handleFileUpload(FileUploadEvent event) {
String fileName = event.getFile().getFileName();
byte[] fileBytes = event.getFile().getContents();
...
}
Solved and solution :
Adding
<h:form enctype="multipart/form-data">
and two libraries ,commons-fileupload and commons-io .For maven projects ;
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId> commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId> commons-io</artifactId>
<version>2.1</version>
</dependency>