Board index JavaServer Faces General page with multiple tags of <p:fileUpload ../> doesn't work

page with multiple tags of <p:fileUpload ../> doesn't work

Components, Ajax Framework, Utilities and More.


Posts: 2
I have page with multiple tags <p:fileUpload ..>, as below
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui">
   <h:head>
   </h:head>
   <h:body>
      <h:form enctype="multipart/form-data">
         <h:panelGrid columns="2">
            <h:outputLabel value="File1"/>
                <p:fileUpload id="file1"  fileUploadListener="#{fileuploadBean.listenFile1}" auto="true" />

            <h:outputLabel value="File2"/>
                <p:fileUpload id="file2"  fileUploadListener="#{fileuploadBean.listenFile2}" auto="true" />

            <h:outputLabel value="File3"/>
                <p:fileUpload id="file3"  fileUploadListener="#{fileuploadBean.listenFile3}" auto="true"  />
         </h:panelGrid>   
      </h:form>
   </h:body>
</html>


public class FileUploadBean {   
   public void listenFile1(FileUploadEvent event) {      
      System.out.println("listening for file1");      
   }
   public void listenFile2(FileUploadEvent event) {      
      System.out.println("listening for file2");      
   }
   public void listenFile3(FileUploadEvent event) {      
      System.out.println("listening for file3");      
   }
}


Only the last one (file3) triggers an upload to the server. unable to uplaod the file through file 1 and file 2 tags above.

Not sure, what is wrong, any help in resolving this issue is greatly appreciated.

It worked in 3.0.M2.

Doesnot work in 3.0.M4 and 3.0.RC2-SNAPSHOT. Unable to test it with 3.0.RC1 because of the issue 3042

Primefaces Version: 3.0.M4, 3.0.RC2-SNAPSHOT
JSF Version: 2.0.4-b09
Server Tomcat: 6.0.29


Posts: 2
I have similar problem. I have multiple tags <p:fileUpload> with auto=true and I have to upload file beginning from the last one. Otherwise nothing happened (post request is not sent). Has anyone found a solution for this issue?


Posts: 15036
Location: Cybertron

It is not supported.
PrimeFaces Lead


Posts: 2
It used to work in 3.0.M2, i have never migrated to 3.0.M3, but I think it works in there to. I haven't seen any documentation in the migration guide that states that this is no longer supported. To me it looks like a defect. If you have any wiki page or documentation on how it is supposed to work (fileupload.js looks like a cryptic code), that would be of great help. May be I can provide it back as a patch.


Posts: 15036
Location: Cybertron

It is not a defect, known limitation of advanced uploader, we will work on it after 3.0.
PrimeFaces Lead


Posts: 2
Thanks for quick answer. I'll resolve it by putting each fileUpload in separate form shown in a dialog.


Posts: 4
So can't we put more than one file upload in a single Form?

Below is the similar one i posted,

viewtopic.php?f=3&t=22529&p=69454#p69454

Please suggest if we can overcome this in any way? Thing is I have to use two file uploads in auto mode in a single form.

thanks,


Posts: 14
Location: Pune, India
Is this still not supported? I am using version 3.5 and facing the same issue when creating my file uploads using primefaces extension dynaform..
DhVaNi
++++++++++++++++++++++++++++++++++
PF 3.5, 4.0-SNAPSHOPT,
PF extensions 0.6.1, 0.7, 1.0-SNAPSHOT
Mojarra (JSF 2.0, 2.1)
Apache tomcat 7.0.x,


Posts: 15036
Location: Cybertron

Same for 3.5, I plan to rewrite advanced uploader for 3.6, we'll see.
PrimeFaces Lead


Posts: 3
It would be very "nice feature" to have this kind of information inside documentation book.

Best regards,
Another person affected.

Next

Return to General