title: How to use PrimeFaces p:fileUpload? Listener method is never invoked or UploadedFile is null / throws an error / not usable
body: <p>I'm trying to upload a file using PrimeFaces, but the <code>fileUploadListener</code> method isn't being invoked after the upload finishes.</p>
  
  <p>Here is the view:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
          mode="advanced" 
          update="messages"
          sizeLimit="100000" 
          allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/&gt;
  
      &lt;p:growl id="messages" showDetail="true"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>And the bean:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class FileUploadController {
  
      public void handleFileUpload(FileUploadEvent event) {
          FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
          FacesContext.getCurrentInstance().addMessage(null, msg);
      }
  
  }
  </code></pre>
  
  <p>I've placed a breakpoint on the method, but it's never called. When using <code>mode="simple"</code> and <code>ajax="false"</code>, it is been invoked, but I want it to work in the advanced mode. I'm using Netbeans and Glassfish 3.1.</p>