title: Upload folder to FTP server
body: <p>I searched here for this topic and I tried all I found, but it still does not work.</p>
  
  <pre><code>    import java.io.FileInputStream;
      import java.io.IOException;
  
      import org.apache.commons.net.ftp.FTPClient;
  
      import android.os.Bundle;
      import android.os.Environment;
      import android.app.Activity;
  
  
      public class MainActivity extends Activity {
  
          public static final String TAG = "Contacts";
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  </code></pre>
  
  <p>I made a Thread, because it wasn't allowed to run it on the main thread;</p>
  
  <pre><code>            Thread t = new Thread(new Runnable(){
                  @Override
                  public void run(){
                      Versuch();
                  }
              });
              t.start();
      }
  </code></pre>
  
  <p>Here I try to upload the data and it does not show me an error in Log Cat.</p>
  
  <pre><code>public void Versuch(){
          FTPClient client = new FTPClient();
          FileInputStream fis = null;
  
          try {
              client.connect("ftp-web.example");
              client.login("ftpuser", "ftppassword");
  
  
              String filename = Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM";
              fis = new FileInputStream(filename);
  
              // Store file to server
              //
              client.storeFile(filename, fis);
              client.logout();
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              try {
                  if (fis != null) {
                      fis.close();
                  }
                  client.disconnect();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
  
  
  
      }
  }
  </code></pre>