2 Replies Latest reply on Nov 12, 2008 4:45 AM by Nicole Schweighardt

    rich:fileupload with tempfiles - listener not called RichFac

    Nicole Schweighardt Novice

      Hi,

      I try to use rich:fileupload.
      I took the example code from the richfaces examples and everything worked fine.
      Then I wanted the component to create temporary files. So I changed the following in the web.xml:

      <init-param>
       <param-name>createTempFiles</param-name>
       <param-value>true</param-value>
      </init-param>


      But then the example is not working any longer. The listener is not called and I can´t find any temp files on my system (Windows XP)
      So I tried to minimize my example to find out why but now I have no more ideas.
      Here is my code:
      ...
      <h:form>
       <rich:fileUpload uploadData="#{fileUploadBean.files}" fileUploadListener="#{fileUploadBean.fileUploadListener}" acceptedTypes="jpg, gif, png, bmp"/>
      </h:form>
      ...


      FileUploadBean.java
      public class FileUploadBean {
      
       private ArrayList<File> files = new ArrayList<File>();
      
       public FileUploadBean(){}
      
      public synchronized void fileUploadListener(UploadEvent event) throws Exception{
       ...//Code not important because listener is not called
       }
      public ArrayList<File> getFiles() {
       return files;
       }
      
       public void setFiles(ArrayList<File> files) {
       this.files = files;
       }
      }

      The FileUploadBean is a managedbean in scope "session":
       <managed-bean>
       <managed-bean-name>fileUploadBean</managed-bean-name>
       <managed-bean-class>de.test.fileupload.tempfiletrue.FileUploadBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>


      Any ideas?
      Thanks a lot
      Nicki