2 Replies Latest reply on Jul 23, 2007 3:39 AM by Tobias Larsson Hult

    s:fileUpload working locally but not remote

    Tobias Larsson Hult Newbie

      Hi,

      I am using the s:fileUpload component in a webapp I am currently developing. When I run the webapp locally on my machine it works great. But when I deploy the app to our test server and try to upload a file the value-binding field is always null.

      Does anyone know what the problem can be? I am running seam 1.2.1 and tomcat 5.5

      Here's the code:

      jspx page:

      <s:fileUpload id="inUploadFile"
       data="#{fileUploadBean.uploadedFile}"
       fileName="#{fileUploadBean.fileName}"
       contentType="#{fileUploadBean.contentType}"
       styleClass="fileUploadInput" />
      
       <h:commandButton id="submitFileAndClose" value="Upload" action="#{fileUploadBean.uploadFile}" />
      

      bean:
      private byte[] uploadedFile;
      public byte[] getUploadedFile()
       {
       log.debug("getUpFile called");
       return uploadedFile;
       }
       public void setUploadedFile(byte[] uploadedFile) {
       this.uploadedFile = uploadedFile;
       }
      public String uploadFile() throws IOException
       {
       if (null == uploadedFile || uploadedFile.length < 1) { //This is always the case on the remote machine
       log.error("No file to upload. Aborting...");
       facesMessages.add("No file chosen");
       return "";
       }
      ...
      ...
      ...
      }