title: Jscape SFTP/FTP upload to root dir fails
body: <p>I have been having an FTP issue using the com.jscape.FileTransfer API that I haven't been able to make sense for quite sometime. Here's my code: </p>
  
  <pre><code>public void do FTPTest() {
      FileTransfer f = protocol.equalsIgnoreCase("FTP") ? new FtpTransfer(ftpHost, userName, password, new Integer((int) port)) : (protocol.equalsIgnoreCase("SFTP") ? new SftpTransfer(
          ftpHost,
          userName,
          password,
          new Integer((int) port)) : null);
      try {
          f.connect();
          f.setAuto();
          System.out.println(f.getDir());
          f.upload("test".getBytes(), "ktest1.txt");
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>This code simply connects to an FTP/SFTP server and uploads a file called "ktest.txt"<br/></p>
  
  <p>My issue happens when I try to upload files to the base directory of the FTP/SFTP site.</p>
  
  <p>Case 1: Connecting to FTP site 'A'</p>
  
  <pre><code>f.getDir() --&gt; '/'
  f.upload() --&gt; SUCCEEDS
  </code></pre>
  
  <p>Case 2: Connecting to SFTP site 'B'</p>
  
  <pre><code>f.getDir() --&gt; '/'
  f.upload() --&gt; FAILS (with permission denied error)
  </code></pre>
  
  <p>However,</p>
  
  <p>Case 3: Connecting to SFTP site 'B'</p>
  
  <pre><code>f.getDir() --&gt; '/'
  f.setDirUp()
  f.getDir() --&gt; ''
  f.upload() --&gt; SUCCEEDS
  </code></pre>
  
  <p>Notice how it works when I do a setDirUp()</p>
  
  <p>If i try to do the same on site A,</p>
  
  <p>Case 4: Connecting to FTP site 'A'</p>
  
  <pre><code>f.getDir() --&gt; '/'
  f.setDirUp() (permission denied error)
  </code></pre>
  
  <p>All cases succeed if a do a setDir('testFolder') before uploading the file. i.e. a dir that is not in the base dir.</p>
  
  <p>I don't understand how doing a setDirUp from '/' --> '' lets you upload a file to the base directory. What happens when you do an UP from '/'. What is '' ?</p>
  
  <p>And how uploading to '/' works for some FTP sites.</p>
  
  <p>BTW both FTP sites lets me upload files to the base dir without any issues using a client like WinSCP.</p>