title: Java FTP upload creates an empty file
body: <p>When I try to upload a simple text file with the Apache Commons <code>FTPClient</code> and this code:</p>
  <pre><code>FTPClient ftp = new FTPClient();
  int reply;
  
  // connect
  try {
  
      ftp.connect(serverAdd);
      ftp.login(username,password);
      reply = ftp.getReplyCode();
  
      if(FTPReply.isPositiveCompletion(reply)){
          System.out.println(&quot;Connected Success..&quot;);
  
          // upload file
          try {
              String fileDir = &quot;testfile.txt&quot;;
              FileInputStream in = null;         
              in = new FileInputStream(fileDir);       
              ftp.storeFile(fileDir,in);
              System.out.println(&quot;File upload complete..&quot;);
          }catch(IOException e){
              System.out.println(e);
          }
  
          ftp.disconnect();
          System.out.println(&quot;Disconnected..&quot;);
  
      }else {
          System.out.println(&quot;Connection Failed..&quot;);
          ftp.disconnect();
      }    
  
  } catch (SocketException ex) {
      ex.printStackTrace();
  } catch (IOException ex) {
      ex.printStackTrace();
  }
  </code></pre>
  <p>A file gets created in the root of the FTP server but it is empty. What's wrong? I already tried to change the ftp mode to BINARY when uploading a PDF file. But the file is also 0 in size.</p>
  <pre><code>ftp.setFileType(FTP.BINARY_FILE_TYPE);
  </code></pre>
  <p>I also only want to upload a bunch of txt files, so the default ascii mode should be fine, right?</p>