4 Replies Latest reply on Sep 2, 2008 6:49 AM by Reinhard Graf

    fileUpload not working correct in modal Panel for multiple f

    Reinhard Graf Newbie

      Hi,

      I have a fileUpload component in a modal panel.
      If I want to upload multiple files the fileUploadListener is only called
      after the first file. All other files are uploaded, but the fileUploadListener
      is not called.

      RF 3.2.1 GA, JBoss 4.2.2 GA, JDK 1.5, Mozilla 2.0.0.16

      In IE 7, the fileUpload is working.

      regards

      Reinhard

        • 2. Re: fileUpload not working correct in modal Panel for multip
          Reinhard Graf Newbie

          hi,

          <a4j:region renderRegionOnly="true">
          <h:outputLabel value="${msg.label_upload_file}" styleClass="customerDetailLabel"/>
          <rich:fileUpload addControlLabel="${msg.button_browse}" maxFilesQuantity="5"
           uploadData="#{uploadFileBean.uploadFiles}" required="true" id="fileUpload"
           listWidth="100%" listHeight="300px"
           fileUploadListener="#{uploadFileBean.uploadFinished}"
           cancelEntryControlLabel="${msg.button_delete}"
           clearAllControlLabel="${msg.button_reset}"
           clearControlLabel=""
           doneLabel="${msg.label_upload_successful}"
           stopControlLabel="${msg.label_upload_stop}"
           uploadControlLabel="${msg.label_upload_upload}"
           eventsQueue="fileupload"
           onupload="hideNote({duration:0.7});"
           onuploadcomplete="refreshList();"
           allowFlash="auto">
          <f:facet name="progress">
          <rich:progressBar style="height: 10px; width: 100%;" interval="3000"/>
          </f:facet>
          <f:facet name="label">
          <h:outputText value="${msg.label_upload_progress}" />
          </f:facet>
          </rich:fileUpload>
          


          public void uploadFinished(UploadEvent event) {
           HtmlFileUpload fileUpload = (HtmlFileUpload) event.getComponent();
           File source = new File(event.getUploadItem().getFile().getAbsolutePath());
           String fileName = FileUtil.getFilename(event.getUploadItem().getFileName());
           Mfat currentDirectory = getCurrentFolder();
           fileName = FileUtil.getRealPath(customerFacade.getFilesFolder())+ currentDirectory.getMfatPathServer() + File.separator + fileName;
           File destination = null;
           try {
           destination = FileUtil.createVersionedFile(fileName);
           FileUtil.copyFile(source, destination, true);
           de.dieselcom.dokupool.data.pojo.File fileData = new de.dieselcom.dokupool.data.pojo.File();
           fileData.setMfat(getCurrentFolder());
           fileData.setMember(getCurrentMember());
           fileData.setFileName(destination.getName());
           fileData.setFileMimeType(new MimetypesFileTypeMap().getContentType(destination));
           fileData.setFileSize(destination.length());
           fileData.setFileDate(new Date());
           fileData.setFileActive(Boolean.TRUE);
           fileData.setFileNote(this.fileNote);
           customerFacade.saveUpload(this.getCurrentMember(),fileData);
           loadFiles();
           this.fileNote = null;
           ErrorHandler.clearErrors(FacesContext.getCurrentInstance());
           BeanUtil.getDialogBean(FacesContext.getCurrentInstance()).setCurrentDialog(null);
           } catch (Exception ex) {
           logger.error("error in uploadFinished",ex);
           FacesContext context = FacesContext.getCurrentInstance();
           ErrorHandler.setError(event.getComponent().getClientId(context),context, ex);
           // File wieder löschen
           if (null != destination) {
           destination.delete();
           }
           }
          
           }
          


          • 3. Re: fileUpload not working correct in modal Panel for multip
            Ilya Shaikovsky Master

            page code not full. does your modal has a form inside?