1 2 3 Previous Next 42 Replies Latest reply on Sep 18, 2013 5:09 AM by bhanu prakash

    richfaces-3.2 - fileUpload

    kaobiore Newbie

      Hi!

      I have some problems getting the fileupload with version 3.2.0.CR5 to work.

      It looks like that the listener (in my case: fileUploadListener(UploadEvent event)) is not called at all?!?!

      Environment:
      jboss-4.2.2
      RI-JSF
      richfaces-3.2.0.CR5 (svn)

      Bean:

       private ArrayList<File> files = new ArrayList<File>();
       private int uploadsAvailable = 5;
       private boolean autoUpload = false;
       public int getSize() {
       if (getFiles().size()>0){
       return getFiles().size();
       }else
       {
       return 0;
       }
       }
      
       public void fileUploadListener(org.richfaces.event.UploadEvent event) throws IOException{
       log.error(">>>>>>>>>>>>>>>>>>>>>>>> LISTENER <<<<<<<<<<<<<<<<<<<<<<<<");
       UploadItem item = event.getUploadItem();
       File file = new File();
       file.setLength(item.getData().length);
       file.setName(item.getFileName());
       file.setData(item.getData());
       files.add(file);
       uploadsAvailable--;
       }
      
       public String clearUploadData() {
       files.clear();
       setUploadsAvailable(5);
       return null;
       }
      
       public ArrayList<File> getFiles() {
       return files;
       }
      
       public void setFiles(ArrayList<File> files) {
       this.files = files;
       }
      
       public int getUploadsAvailable() {
       return uploadsAvailable;
       }
      
       public void setUploadsAvailable(int uploadsAvailable) {
       this.uploadsAvailable = uploadsAvailable;
       }
      
       public boolean isAutoUpload() {
       return autoUpload;
       }
      
       public void setAutoUpload(boolean autoUpload) {
       this.autoUpload = autoUpload;
       }
      


      jsp:
       <rich:fileUpload fileUploadListener="#{componentBean.fileUploadListener}"
       maxFilesQuantity="#{componentBean.uploadsAvailable}"
       id="upload"
       listWidth="300"
       listHeight="80"
       immediateUpload="#{componentBean.autoUpload}"
       acceptedTypes="jpg, gif, png, bmp">
       <a4j:support event="onuploadcomplete" reRender="datatable_files" />
       </rich:fileUpload>
      


      Any ideas?

      Thanks!

      -=k=-

        1 2 3 Previous Next