I want to use the fileupload component. But when clicking upload, handleFileUpload is not called.
I followed the showcase and the userguide. What am I doing wrong?
(using tomcat 7, primefaces2.2.1, mojarra and richfaces)
Added to xhtml
Code: Select all
<p:fileUpload id="fileupload" fileUploadListener="#{fleetVehicleDetail.handleFileUpload}"
allowTypes="*.jpg;*.png;*.gif;" description="Images"/>
Code: Select all
public void handleFileUpload(FileUploadEvent event) throws IOException, MWSException {
getLog().info("Uploaded: {}" + event.getFile().getFileName());
uploadFiles.add(event.getFile());
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
saveFilesToMiles(0);
}
Code: Select all
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>
org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
Code: Select all
<partial-response><changes><update id="javax.faces.ViewState">538047616138701769:1334201969601066705</update></changes><extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension></partial-response>
extensionfilter in web.xml
Code: Select all
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.webapp.filter.ExtensionsFilter
</filter-class>
<init-param>
<description>
Set the size limit for uploaded files. Format: 10 - 10
bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<description>
Set the threshold size - files below this limit are
stored in memory, files above this limit are stored on
disk.
Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
</description>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>