11 Replies Latest reply on Jan 10, 2011 2:17 PM by brenoaraujo

    rich:fileupload problem.

    agallo73

      Hello, I have a problem with the fileUpload component.

       

      I'm using a   three step wizard.

       

      In the first step page, a rich:fileupload component is used to give the user the possibility of uploading files and show a preview of what has been done.

       

      In the second step, a new panel shows up with a listshuttle showing the uploaded files and giving the user the chance to select which is the main one and which are the attachments  and order them.

       

      This panel has back and continue buttons to allow the user to go back or continue invoking a service that performs some work on the files and gives the result in the last panel.

       

      The problem is that if I press the back button and come back to the first page, The rich:fileupload component shows up empty even if the preview still continues preserving the uploaded files. My backed bean containing the files has a session scope.

       

      Is there some way to prevent this behaviour and make the fileupload component persist the list of uploaded files that were shown before moving to the next panel containing the listshuttle?

       

      It seems that refreshing the page deletes the in memory list of files. I see that uploadData referenced variable still has the uploaded elements when I come back to the first page but nothing is dispalyed.

       

      May someone help me please?

        • 1. Re: rich:fileupload problem.
          ilya_shaikovsky
          File Upload do not holds files itself but just passing them to listener in order you to store them. So every time it's reREndering its didn't care about the files which aleady being uploaded in the past. So it's impossible to show something in upload from previous uploads list.
          • 2. Re: rich:fileupload problem.
            agallo73

            Ok thanks.

             

            So, How can I solve this problem? There's no solution that you think may help me?

             

            I thought that being my bean session scope defined there was some way to keep some data. The uploaddata attribute should serve this purpose being it related to the data being uploaded.When I upload a new file, I saw that the framework automatically populates the list pointed by the uploaddata attribute. So why not using this variable to rerender the component when coming back?

             

            Am I saying stupid things?

             

            Moreover I would like to cancel a file from my bean in memory list when  someone press clears in the fileupload component.

             

             

            I think that i may use a4j:support event="onclear" actionListener="someListener"

             

            but I can I figure out which file has been removed and which event I have to manage in my listner method?

             

            Is there some information there as far as the element being removed?

             

            Thanks very much.

            Bye.

            • 3. Re: rich:fileupload problem.

              so, fileuploader has the different behavior from other gui components and breaks view<->model concept,

              why?

               

              also, for example, we can have some inputs on page with fileuploader and if validation fail on these fields then fileuploader become empty and user will be confused, bad behavior….

              • 4. Re: rich:fileupload problem.
                ilya_shaikovsky

                Thanks for your report! Now we will discuss possible inclusion to upcoming release https://jira.jboss.org/jira/browse/RF-8538

                 

                About handling upload itself - it's standard way to make the user responsible for storing the files at server side and not just put to model.

                • 5. Re: rich:fileupload problem.
                  m.a.g

                  RF-8538 was closed as "Cannot Reproduce"!

                  • 6. Re: rich:fileupload problem.
                    nbelaevski

                    Denis,

                     

                    Right, I couldn't reproduce the problem described in RF-8538. Additional investigation showed that the problem was in incorrect test code (nested a4j:support for "onuploadcomplete" that wasn't ajaxSingle). Do you have any issues with file upload & validation? Please let us know. 

                    • 7. Re: rich:fileupload problem.
                      brenoaraujo

                      Nick,

                      the problem reported by Antonio is that he can't restore the fileUpload component.

                      I'm having the same trouble. My scenario is that I'm adding a uploadData (list of UploadItem's) and it has not been displayed.

                      Do you have any solution for this? I just want to show to user the files that he has uploaded in the same component.

                      Thanks

                      • 8. Re: rich:fileupload problem.
                        nbelaevski

                        Breno,

                         

                        So, can you please clarify what's the problem? Is it that uploaded data is not displayed or uploaded files list is cleared out when user uses 'back' etc buttons?

                        • 9. Re: rich:fileupload problem.
                          brenoaraujo

                          Both problems happens.

                          If I associate the uploadData to a list os Upload itens in ManagedBean the itens are not displayed when page is rendered.

                          If I restore a MB state that has uploaded files within the fileUpload component this files desappears.

                           

                          Example for problem 1:

                           

                          at JSP:

                          <rich:fileUpload uploadData="#{MB.fileLst}"/>

                           

                          at MB:

                          private List<UploadItem> fileLst = new ArrayList<UploadItem>();

                           

                          public String showMB() {

                                    fileLst.add(new UploadItem("example.txt", 1024, "text/plain", file));

                                  return "navigationURL";

                          }

                           

                          When page is rendered there are no upload itens in fileUpload componente.

                          • 10. rich:fileupload problem.
                            nbelaevski

                            Ok, I see - such feature is not supported.

                            • 11. rich:fileupload problem.
                              brenoaraujo

                              Why you don't implement the save and restore state for this component?