10 Replies Latest reply on Oct 13, 2009 9:33 AM by Olli H.

    Dynamic HtmlFileUpload doesn't work in 3.3.1 GA

    Olli H. Newbie

      Hi,

      i have tried to get the fileupload working with RF 3.3.1 GA. The upload seems to work but no uploadListener is called afterwards. So i am not able to get the file as bytestream.


      What am I doing wrong?

      Here is my config.


      <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       <init-param>
       <param-name>createTempFiles</param-name>
       <param-value>false</param-value>
       </init-param>
       <init-param>
       <param-name>maxRequestSize</param-name>
       <param-value>2000000</param-value>
       </init-param>
       </filter>



      And here the other code

      ......
      AjaxForm form = new AjaxForm();
      IdUtils.assignId(form);
      
      ....
      
      HtmlFileUpload fileUpload = new HtmlFileUpload();
      IdUtils.assignId(fileUpload);
      fileUpload.setListHeight("45px");
      fileUpload.addFileUploadListener(new SubformFileUploadListener());
      fileUpload.setMaxFilesQuantity(1);
      
      
      form.getChildren().add(fileUpload);
      
      
      


      The form is placed on a simple HtmlAjaxOutputPanel.

      and here the simple fileUploadListener

      public class SubformFileUploadListener implements
       FileUploadListener {
      
       private static final Log _logger = LogFactory
       .getLog(SubformFileUploadListener.class);
      
      
       @Override
       public void processUpload(UploadEvent event) {
       UploadItem item = event.getUploadItem();
      
       StringBuilder sb = new StringBuilder();
       sb.append("\n "+item.getContentType());
       sb.append("\n"+item.getData());
      
       if (_logger.isInfoEnabled()) {
       _logger.info(sb.toString());
       }
       }
      }


      I hope someone can help me?