title: primefaces upload not doing anything
body: <p>i am now trying to use primefaces instead of a home-brewed file upload  system, only problem i am having is it seems not to do anything, any ideas why ?</p>
  
  <p>i am using glassfish, and i have added </p>
  
  <p>commons-io-1.4.jar
  commons-fileupload-1.2.1/jar</p>
  
  <p>to my libraries in netbeans</p>
  
  <p>heres my xhtml </p>
  
  <pre><code>&lt;p:fileUpload fileUploadListener="#{fileUploadController.upload}"
                                    mode="advanced" 
                                    update="messages"
                                    sizeLimit="100000000" 
                                    allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/&gt;
  
                      &lt;p:growl id="messages" showDetail="true"/&gt;
  </code></pre>
  
  <p>web.xml, </p>
  
  <pre><code>          &lt;filter&gt;
      &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.primefaces.webapp.filter.FileUploadFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;thresholdSize&lt;/param-name&gt;
          &lt;param-value&gt;51200&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;uploadDirectory&lt;/param-name&gt;
          &lt;param-value&gt;C:\Users\Richard\printing~subversion\fileupload\web\Uploaded&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>FileUploadController.java</p>
  
  <pre><code>    @ManagedBean(name="fileUploadController")
  public class FileUploadController {
     private String destination="C:/Users/Richard/printing~subversion/fileupload/web/Uploaded";
  
      public void upload(FileUploadEvent event) {  
          FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() + " is uploaded.");  
          FacesContext.getCurrentInstance().addMessage(null, msg);
          // Do what you want with the file        
          try {
              copyFile(event.getFile().getFileName(), event.getFile().getInputstream());
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }  
  
      public void copyFile(String fileName, InputStream in) {
             try {
  
  
                  // write the inputStream to a FileOutputStream
                  OutputStream out = new FileOutputStream(new File(destination + fileName));
  
                  int read = 0;
                  byte[] bytes = new byte[1024];
  
                  while ((read = in.read(bytes)) != -1) {
                      out.write(bytes, 0, read);
                  }
  
                  in.close();
                  out.flush();
                  out.close();
  
                  System.out.println("New file created!");
                  } catch (IOException e) {
                  System.out.println(e.getMessage());
                  }
      }
  }
  </code></pre>
  
  <p>i have also tried this example : <a href="http://e-blog-java.blogspot.co.uk/2010/04/ppr-multi-file-upload-with-primefaces.html" rel="nofollow">http://e-blog-java.blogspot.co.uk/2010/04/ppr-multi-file-upload-with-primefaces.html</a></p>
  
  <p>but the issue is when i copy the code i can not get the upload to display ?</p>
  
  <p>anyone got any ideas whats going on ? </p>
  
  <p>Thanks</p>