3 Replies Latest reply on Jan 30, 2007 7:49 AM by hubaer

    Tomahawk File Upload

      Hello ....


      I am using tomahawk for uploading files in a SEAM application ... I followed the guide on

      http://www.onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=1


      An example of my code in the uploadBean is as follows:

      
       public void importActions() throws FileNotFoundException, IOException{
       this.upload();
       String path=this.uploadFile.getName();
      
       CSVReader reader = new CSVReader(new FileReader(path));
      
       List<Action>importList = new LinkedList<Action>();
      
      
      
       String [] nextLine;
      
       while ((nextLine = reader.readNext()) != null) {
       Action instance = new Action();
      
       String instanceName = nextLine[0];
       instance.setActionId(actionDAO.getNewActionId());
       instance.setActionIndex(actionDAO.getNewActionIndex());
       instance.setActionName(instanceName);
      
       if(actionDAO.IsActionNameValid(instanceName)){
       actionDAO.merge(instance);
       }
       Events.instance().raiseEvent("refreshActions");
       }
       }
      
      


      This method correctly uploads a csv file on to the specified directory on the machine where the jboss AS is running .... Everything worked fine as long as the application was running on my local machine !!


      When i deployed the application onto one of our remote servers, the file upload process failed as the filepath variable assigned as the file path of the file which is found on pc !!


      Can anyone tell me how to retrieve the filePath of the file which has been uploaded on the remote server itself ?/

      Regards,
      Yogesh






        • 1. Re: Tomahawk File Upload

          Hi Yogesh,

          I'm not sure if I can really help you, but you can configure the tomahawk File Upload to store the tempory files on your file system or in your ram.

          So could it be that on your remote servers the files are stored in the ram and therefore the getName() method cannot return the real file location to you, because the file doesn't really exist on the file system.

          Why don't you use the getInputStream method and wrap this with an InputStreamReader to your CSVReader?

          Regards
          Marco

          • 2. Re: Tomahawk File Upload
            kukeltje

            or use the new seam jsf upload component

            • 3. Re: Tomahawk File Upload

              Hi Ronald,

              Is there an example for using the seam file upload component? The Wiki only explain how to use tomahawk for uploading files.

              Regards
              Marco