2 Replies Latest reply on Dec 25, 2008 9:48 PM by visumagic

    Problem with Seam Fileupload

    visumagic

      Hi
      Im trying to upload a file using s:fileUpload .


      <s:validateAll>
                  <s:decorate id="valueField" template="layout/edit.xhtml">
                      <ui:define name="label">Value</ui:define>
                             <s:fileUpload id="picture" value="#{upload.picture}" accept="image/png"
                                   contentType="#{upload.pictureContentType}"/>
                                    
                                    </s:decorate>
           </s:validateAll>
      



      And the action is



      @Name("upload")
      public class Upload
      {
          @Logger private Log log;
          
          private byte[] picture;
          private String pictureContentType;
          
          public byte[] getPicture() {
                return picture;
           }
      
           public void setPicture(byte[] picture) {
                this.picture = picture;
           }
      
           public String getPictureContentType() {
                return pictureContentType;
           }
      
           public void setPictureContentType(String pictureContentType) {
                this.pictureContentType = pictureContentType;
           }
      
           
          public void upload()
          {
               log.info(pictureContentType);
            log.info(picture);
               
          }
      
      }
      



      I'm not able to get the file data in the action. It's always showing null..


      plz help me


      thanks
      raghu

        • 1. Re: Problem with Seam Fileupload
          visumagic
          hi
          issue fixed .. , missed enctype="multipart/form-data" in the form


          thanks
          raghu
          • 2. Re: Problem with Seam Fileupload
            visumagic
            Still I'm left with few doubts..

            1)What is the difference between s:fileUpload and rich:fileUpload
            is there any special advantages with s:upload

            2)I want a from with text and multipart inputs
            like profile edit where i can upload my photo as well as I
            can submit some general form controls.
            How can I implement


            Example: My Seam forum profile edit
            http://www.seamframework.org/userHome_d.seam?userId=48323#userProfile

            plz suggest me

            thanks
            raghu