fileUpload fileUploadListener problem

UI Components for JSF
Post Reply
mujer_esponja
Posts: 4
Joined: 17 Aug 2011, 16:24

17 Aug 2011, 16:27

Heelo!! I would like to implement a multitiple uploader in my page.
I tryed with primefaces implementation, using 2.2.1 version with no success.

The code in the xhtml page:

Code: Select all

  <p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"   
        multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/>
And the code in backend function:

Code: Select all

 public void uploadListener(org.primefaces.event.FileUploadEvent event) throws CommonUtilsException {
    		log.write("Upload.");
    	}
I tryed to follow the explanation in the documentation http://www.primefaces.org/showcase/ui/f ... ltiple.jsf, but even though, the backend function is not reached. Any ideas about what I am missing??
Thans in advance

EDIT:
As I could see in other threads, I add this suggestion

Code: Select all

<h:form enctype="multipart/form-data" prependId="false">
    					<p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"   
        multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/> 
    					</h:form>
The result is the same
PrimeFaces 2.2.1, Mojarra 2.1.1-b04, MacOs

mujer_esponja
Posts: 4
Joined: 17 Aug 2011, 16:24

17 Aug 2011, 17:03

I found the solution. I needed to edit the file web.xml, adding this filter:

Code: Select all

<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>2097152</param-value>
</init-param>     
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>  
I found this article http://java.dzone.com/articles/how-uplo ... aces-under very useful
PrimeFaces 2.2.1, Mojarra 2.1.1-b04, MacOs

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests