2 Replies Latest reply on Apr 18, 2007 10:06 AM by Chris Hane

    <s:fileUpload/> IE/Firefox Filename differences

    Chris Hane Novice

      I'm using Seam1.2.0patch1.

      The filename parameter on <s:fileUpload/> is different between IE and Firefox. On Firefox, I get just the filename. On IE (6.x), the path + filename is returned.

      Is this expected?

      My page is:

      <h:form enctype="multipart/form-data" id="f1">
       <h:commandLink action="#{backing.uploadFile}" value="Upload"/>
       <s:fileUpload id="importfile" data="#{backing.dataFile}"
       fileName="${backing.fileName}"/>
      </h:form>
      


      My Bean Action is:
      public String uploadFile(){
      
       if(dataFile==null || dataFile.length==0){
       facesMessages.add("File was empty!");
       return FORM_UPLOAD;
       }
      
       verifyDirectory(step.getTemplatePath());
      
       File file = new File(step.getTemplatePath() + fileName);
       if(file.exists()){
       facesMessages.add("File already exsits! ");
       return "formUpload";
       }
      
       OutputStream bos=null;
       bos = new FileOutputStream(file);
       for(int x=0; x<dataFile.length; x++){
       bos.write(dataFile[x]);
       }
       return "success";
       }