1 Reply Latest reply on Aug 1, 2008 12:37 AM by hai yenbai

    fileupload, uploadItem getData is null

    hai yenbai Newbie

      Hi i tried fileupload demo , but i can not getdata of uploaded filebecause it is null, bytes of UploadItem return null.
      listener method

      public synchronized void listener(UploadEvent event) throws Exception{
       UploadItem item = event.getUploadItem();
       File file = new File();
       file.setName(item.getFileName());
       file.setData(item.getData());
       Object obj = this.getFiles().get(0);
       System.out.println (this.getFiles().size());
      
       }
      

      jsp file
      <h:form>
       <h:panelGrid columns="2" columnClasses="top,top">
       <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
       maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
       id= "upload" acceptedTypes="jpg, gif, png, bmp" uploadData="#{fileUploadBean.files}">
      
       </rich:fileUpload>
      
       </h:panelGrid>
       </h:form>