5 Replies Latest reply on Aug 29, 2012 6:20 AM by Lidija Milevska

    rich:fileUpload + a4j:support help

    Lidija Milevska Newbie

      Hi All

      I need help

      Using rich 2.0.

      Here is my code:

       

      <h:outputText id="image1Gifw" value="#{wapPageProductBean.image1Gif.imageName}" style="color:#3F85E7; font-size: 16px;"></h:outputText>

                                      <br></br><br></br>

                                      <rich:fileUpload fileUploadListener="#{wapPageProductBean.uploadImage1Gif}"

                                          id="imageUploader1128"

                                          maxFilesQuantity="10"

                                          immediateUpload="true"

                                          acceptedTypes="gif"

                                          ontyperejected="alert('Only GIF files can be uploaded');"

                                          onerror="alert('There was an error during upload')"

                                          autoclear="true" listHeight="50px" listWidth="250"

                                          rendered="#{wapPageProductBean.currentContentType.id != 12

                                          and wapPageProductBean.currentContentType.id != 9

                                          and wapPageProductBean.currentContentType.id != 10}">

                                          <a4j:support id="OneGifWap" event="onuploadcomplete" reRender="image1Gifw" ajaxSingle="true" ignoreDupResponses="true"

                                              status="LATA4JStatus"/>

                                      </rich:fileUpload>

       

       

      <h:outputText id="image1Pngw" value="#{wapPageProductBean.image1Png.imageName}" style="color:#3F85E7; font-size: 16px;"></h:outputText>

                                      <br></br><br></br>

                                      <rich:fileUpload fileUploadListener="#{wapPageProductBean.uploadImage1Png}"

                                          id="imageUploader11281"

                                          maxFilesQuantity="10"

                                          immediateUpload="true"

                                          acceptedTypes="png"

                                          ontyperejected="alert('Only PNG files can be uploaded');"

                                          onerror="alert('There was an error during upload')"

                                          autoclear="true" listHeight="50px" listWidth="250"

                                          rendered="#{wapPageProductBean.currentContentType.id != 12

                                          and wapPageProductBean.currentContentType.id != 9

                                          and wapPageProductBean.currentContentType.id != 10}">

                                          <a4j:support id="OnePngWap" event="onuploadcomplete" reRender="image1Pngw" ajaxSingle="true" ignoreDupResponses="true"

                                              status="LATA4JStatus"/>

                                      </rich:fileUpload>

       

      ...

       

      Basicly for every screen size that i have in my list I need to upload diffrent images (image1, image2 ...) and the name need to be shown after the upload is done.

      Sometimes its working ok, but sometimes it stopes. I cannot even save the ones that are successfully uploaded.

      There is no error or something else, but like the request is gone. Tried to see if some error is happening with firebug, it looks ok...

      Any help is appreciated.

        • 1. Re: rich:fileUpload + a4j:support help
          nguyen tung son Newbie

          I have this code, do not know if that helps you?

           


          <rich:fileUpload id="uploadDoc1" style="width:100%;border:none;height:100%"

                                                                                           onuploadcomplete="self.parent.location.href='#{uploadController.time}'"

                                                                                           acceptedTypes="#{uploadController.type}"

                                                                                           uploadControlLabel="Upload"

                                                                                           addControlLabel=" file choose"

                                                                                           clearAllControlLabel="All delete"

                                                                                           clearControlLabel="delete"

                                                                                           cancelEntryControlLabel="Cancel"

                                                                                           doneLabel=""

                                                                                           sizeErrorLabel="size error."

                                                                                           transferErrorLabel="upload error"

                                                                                           progressLabel="Uploading ..."

                                                                                           maxFilesQuantity="10"

                                                                                           fileUploadListener="#{uploadController.uploadDocListener}"

                                                                                           listHeight="108px"

                                                                                           allowFlash="true"

                                                                                           uploadListClass="uploadListClass">

           

                                                                              <f:facet name="label">

                                                                                  <h:outputText value="Upload {_KB}KB từ {KB}KB --- {mm}:{ss}"></h:outputText>

                                                                              </f:facet>

                                                                              <f:param value="#{uploadController.pagereload}" name="page"/>

                                                                              <f:param value="#{uploadController.table}" name="table"/>

                                                                              <f:param value="#{uploadController.fs200}" name="fs200"/>

           

                                                                          </rich:fileUpload>

          • 2. Re: rich:fileUpload + a4j:support help
            Lidija Milevska Newbie

            Hi nguyen

            10x for replay, it didnt helped me .

            It is not the problem of rendering, it is like the request is gone even i see it with firebug. Sometimes is ok, sometimes is gone, i dont get it.

            I thought that the problem could be that i dont have id on every rich:fileUpload, a4j:support and a4j:commandButton, now i put it and testing it.

            • 3. Re: rich:fileUpload + a4j:support help
              Lidija Milevska Newbie

              After I removed the

              <a4j:support id="OneGifWap" event="onuploadcomplete" reRender="image1Gifw" ajaxSingle="true" ignoreDupResponses="true"

                                                      status="LATA4JStatus"/>

              from <rich:fileUpload> it works like a charm, no gone requests.

              • 4. Re: rich:fileUpload + a4j:support help
                nguyen tung son Newbie

                Hi Lidija..

                You already have the answer ...You can share the experience for everyone

                • 5. Re: rich:fileUpload + a4j:support help
                  Lidija Milevska Newbie

                  but why is this happening?