1 Reply Latest reply on Apr 1, 2010 5:04 PM by Gabor Jakab

    getting folder path

    serd SERDAR Newbie

      Hi, I want to upload my files to img directory of my project. But i need to determine the full path of this folder. When I try to get user directory I use System.getProperty(user.dir);


      Is there any way to get full path of projects folders?


      Also I check tutorials about seam file upload but the ones that I see are about uploading files to database. If someone directs me to examples about uploading files to file system I will be happy.

        • 1. Re: getting folder path
          Gabor Jakab Newbie

          Hi,


          Should work. If you have the appropriate permissions you can even do sg. like:


          ...
          srcDirF = new File(srcDir);
          if(!srcDirF.isDirectory()){
               log.error("InvalidConfigValue, srcDir: #0", srcDir);
               throw new InvalidConfigValueException("Invalid srcDir");
          }
          ...
          


          then e.g. use operations from java.io to create, move, delete... files



          However! in Java EE environment it is usually not safe to simply reference libraries of your underlying system, i.e. outside of your application context. For this you could better use a CMS, e.g. apache jackrabbit...