7 Replies Latest reply on Jan 5, 2012 12:00 PM by nk10ere

    fileUpload with Internet Explorer 8

    nk10ere Newbie

      Hi to all,

       

      I have problems with rich:fileUpload in Interner Explorer 8.

       

      While in other browsers (firefox, chrome) the component works fine, in internet explorer 8 if the file is larger than 250 KB then nothing happens.

       

      I am using RichFaces 3.3.0 and JSF 1.2.

       

      To explain in more detail: when the upload is finished (onuploadcomplete) I try to reRender a panel that shows the uploaded files (zipped files were uploaded). In all browsers except IE8 the files are displayed fine after reRendering. in IE8 the panel remains empty.

       

      Is that a known issue? Can you please help me see anything wrong from my side?

       

      Kind regards and thanks

        • 1. Re: fileUpload with Internet Explorer 8
          Christian Peter Expert

          there are to ways you could try:

           

          a) web.xml

          <context-param>

              <param-name>com.sun.faces.enableViewStateIdRendering</param-name>

              <param-value>true</param-value>

            </context-param>

           

          but this will create multiple input type hidden elements for each form with the same id

           

          c)

          patch richfaces' fileupload js code:

           

          LoadWatcher.prototype.findViewState = function (D) {

                return jQuery("input[name='javax.faces.ViewState']:first");   

          }

          • 2. Re: fileUpload with Internet Explorer 8
            nk10ere Newbie

            Thank you for your prompt reply Christian.

             

            However, I can not follow your second suggestion because modifying the richFaces component means that I need to re-modify it over and over upon a richFaces upgrade.

             

            Trying your first suggestion also, did not change anything: IE 8 seems to be working forever when it is to rerender my panel (I did not have problems with IDs since I don't have a form in my xhtml). And this happens when I try to upload a zip file containing many xml files (and only on IE). If i try to upload a zip file with one xml inside, IE works fine.

             

            Any other ideas?

            • 3. Re: fileUpload with Internet Explorer 8
              Christian Peter Expert

              I don't think modifying richfaces' code is real problem for richfaces version 3.3.x since there is almost no activity and plans for another rf3 release in the future. We've modified a lot of richfaces' both clientside and serverside behavior. (Like which styleClasses should be rendered in modalPanel, TabPanels or adding additional functionality for saving the extendeddatatables tablestate on every resize or dnd action.

               

              Fixing the position of the horizonal scrollbar of the extdts is yet another example...

               

              But back to your issues...

               

               

              you don't have a form in your xhtml files? The rich:fileupload requires a form.

               

              Are you using the flashmode?

               

              Are you using https (ssl)?

               

              will the fileuploadlister  been called?

              • 4. Re: fileUpload with Internet Explorer 8
                nk10ere Newbie

                1)

                I don't have a form, at list not explicitely. The structure is the following:

                 

                <ui:composition>

                     <rich:panel id="containerPanel">

                          <i:twoColumns>

                               <ui:define name="left">

                                    <rich:panel id="tobesubmittedfilePanel"          header="#{bundle.file_popup_smenu}" rendered="true" width="100%">

                                         <rich:fileUpload id=".....

                 

                Does any of the preceding tags create a form under the hood? (i:twoColumns is custom and it does NOT create a form!)

                 

                2)

                in my rich:fileUpload component i have allowFlash="false"

                 

                3)

                I don't use SSL

                 

                4)

                the listener is always called

                 

                I have concluded that the problem with IE8 is on rendering. I have changed my code a little bit to not call the action in the backing and reRender at the same time (initially thinking that the reRendering was taking place before the action completes filling the bean). So what I did was to fill the backing bean before the listener returns and in the onuploadcomplete event I only performed the reRender (if my initial coclusion was right, then IE8 would be able to reRender since the bean was ready). However, nothing changed. IE8 does not rerender when the bean is big.

                 

                Since these changes made no good I turned them back. Here the component:

                <rich:fileUpload id="fupload_comp" listHeight="225" listWidth="480"

                                                                            autoclear="true" fileUploadListener="#{bean.uploadListener}"

                                                                            allowFlash="false" acceptedTypes="xml, zip" noDuplicate="true"

                                                                            maxFilesQuantity="1000"

                                                                            stopControlLabel="#{bundle.upload_stop_control}"

                                                                            stopEntryControlLabel="#{bundle.upload_stop_entry_control}"

                                                                            uploadControlLabel="#{bundle.upload_control}"

                                                                            transferErrorLabel="#{bundle.upload_transfer_error}"

                                                                            addControlLabel="#{bundle.upload_add_control}"

                                                                            cancelEntryControlLabel="#{bundle.upload_cancel_entry_control}"

                                                                            clearAllControlLabel="#{bundle.upload_clear_all_control}"

                                                                            clearControlLabel="#{bundle.upload_clear_control}"

                                                                            sizeErrorLabel="#{bundle.upload_size_error_control}"

                                                                            doneLabel="#{bundle.upload_done}">

                                                                            <a4j:support event="onuploadcomplete"

                                                                                      action="#{bean.handleUploadFinished}" requestDelay="1500"  limitToList="true"

                                                                                      reRender="uploadItemPanel,fileInfoPanel" />

                                                                  </rich:fileUpload>

                 

                The panel I need reRendered is uploadItemPanel.

                 

                Many thanks for your time.

                 

                P.S.

                I just made some tests with OPERA and SAFARI browsers. They work perfect just as CHROME and FIREFOX do, leaving IE8 the black ship of the family. Now, it does not surprise me, I'm just saying ...

                • 5. Re: fileUpload with Internet Explorer 8
                  nk10ere Newbie

                  Another note:

                   

                  To temporarily fix it, I added a commandLink that just performs a reRender.

                   

                  What might be notable here is: if I use a h:commandLink it works GREAT. The panel is rerendered. BUT if I use a a4j:commandLink it does not rerender.

                   

                  It seems that the problem lies in a4j:support then ?

                  • 6. Re: fileUpload with Internet Explorer 8
                    nk10ere Newbie

                    I also tried modifying fileupload.js as you proposed.

                     

                    I entered your code in line 392 right before FileUpload = {};

                     

                    I 'm not sure that is the right place (I'm worst than newbie with javascript ... more like a byebye) but the result is that now the files are not even uploaded. Seems like trying to upload forever (IE only again.)

                    • 7. Re: fileUpload with Internet Explorer 8
                      nk10ere Newbie

                      Finally,

                       

                      all the problems were caused by the rich:orderingList in which I used to display the data after rerendering.

                       

                      I changed that to dataList or dataGrid and even IE works fine.