我怎样才能轻松做到:
我在这里正确保存了所有file.directories:ArrayList fileList = new ArrayList();
如何使用此方法上传它们?
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();
}
}