0

How can I easy do that:

I have correctly saved all file.directories here: ArrayList fileList = new ArrayList();

And how can I upload them using this method?

public static FTPClient con = null;

public static void upload(String path, String fileName)
{
    try
    {
        con = new FTPClient();
        con.connect("server");

        if (con.login("login", "pass"))
        {

            con.enterLocalPassiveMode(); // important!
            con.setFileType(FTP.BINARY_FILE_TYPE);

            String data = path;

            FileInputStream in = new FileInputStream(new File(data));
            boolean result = con.storeFile("/Test/" + fileName, in);
            in.close();

            con.logout();
            con.disconnect();
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
HanzUpp3r
  • 51
  • 3
  • 8
  • list all the files means? listing files which are in ftp dir? – KOTIOS Nov 11 '14 at 07:06
  • Try this answer once -->http://stackoverflow.com/questions/24731838/loop-to-upload-list-images-one-by-one – KOTIOS Nov 11 '14 at 07:08
  • http://android-spirit.blogspot.in/2013/08/uploading-file-to-webservice-using-ksoap.html – Nirmal Nov 11 '14 at 07:11
  • Ty for this, but I'm looking for some easy and simple code which save all images paths to an array and somethink like for(File f : array) upload f – HanzUpp3r Nov 11 '14 at 08:41

0 Answers0