title: RichFaces fileUpload unable to invoke listener
body: <p>For <code>&lt;rich:fileUpload&gt;</code> I'm unable to invoke <code>listener</code>. When I checked in firebug console I found that its going in infinite <code>GET</code> requests loop.</p>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;org.richfaces.fileUpload.maxRequestSize&lt;/param-name&gt;
      &lt;param-value&gt;1000000000&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;org.richfaces.fileUpload.createTempFiles&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>Facelet:</p>
  
  <pre><code>    &lt;h:form enctype="multipart/form-data"&gt;
          &lt;rich:fileUpload fileUploadListener="#{fileUploadController.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp"
                  ontyperejected="alert('Only JPG, GIF, PNG and BMP files are accepted');" maxFilesQuantity="5"&gt;
                  &lt;a4j:ajax event="uploadcomplete" execute="@none" render="info" /&gt;
          &lt;/rich:fileUpload&gt;
      &lt;/h:form&gt;
  </code></pre>
  
  <p>Backing Bean:</p>
  
  <pre><code>public void listener(FileUploadEvent event) throws Exception{
  UploadedFile item = event.getUploadedFile();
  uploadFile.setLength(item.getData().length);
  uploadFile.setName(item.getName());
  uploadFile.setData(item.getData());
  writeFile();
  }
  
  public void writeFile() {  
  
  FileOutputStream fop = null;  
  File file;
  try {
  
      file = new File(fPath + uploadFile.getName());
      logger.info(fPath + uploadFile.getName());
  
      fop = new FileOutputStream(file);  
      if (!file.exists()) {  
          file.createNewFile();  
      }  
  
      fop.write(uploadFile.getData());  
      fop.flush();  
      fop.close();    
  
  } catch (IOException e) {  
      e.printStackTrace();  
  
  } finally {  
      try {  
          if (fop != null) {  
              fop.close();  
          }  
      } catch (IOException e) {  
          e.printStackTrace();  
      }  
  }  
  </code></pre>
  
  <p>I checked a lot of similar questions but didn't got any clue !</p>
  
  <p>I'm using RichFaces version 4.2.2</p>