title: Uploading files to a webserver java FileUpload
body: <p>I'm using apache's <code>FileUpload</code> in order to upload some files to my webserver. Problem is I don't want to upload them to a specific location on the machine i.e : <code>c:\tmp</code>, but rather to a relative path such as <code>/ProjectName/tmp/</code></p>
  
  <p>Here's my code:</p>
  
  <pre><code>private static final long serialVersionUID = 1L;
  private String TMP_DIR_PATH = "c:\\tmp";
  private File tmpDir;
  private static final String DESTINATION_DIR_PATH ="/files";
  private File destinationDir;
  
  public void init(ServletConfig config) throws ServletException {
      super.init(config);
      tmpDir = new File(TMP_DIR_PATH);
      if(!tmpDir.isDirectory()) {
          throw new ServletException(TMP_DIR_PATH + " is not a directory");
      }
      String realPath = getServletContext().getRealPath(DESTINATION_DIR_PATH);
      destinationDir = new File(realPath);
      if(!destinationDir.isDirectory()) {
          throw new ServletException(DESTINATION_DIR_PATH+" is not a directory");
      }
  }
  </code></pre>
  
  <p>I want to change <code>TMP_DIR_PATH</code> so it's relative to my project, help would be appreciated!</p>