1、上传本地图片至远程ftp服务器
@Test
public void uploadFTP() throws IOException {
String fj = "";
FTPClient ftp = new FTPClient();
String baseFtpPath = "ftp://102.0.171.174:21";
String localFilePath = "G:\\work\\1.png";
String ftpPath = "/usr/faceScan/aa/" + "text.png";
if (!ftp.isConnected()) {
int reply;
ftp.connect("102.0.171.174", 21);
ftp.login("root", "123456");
reply = ftp.getReplyCode();
System.out.println(reply);
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
}
}
File localFile = new File(localFilePath);
String ftpDir = ftpPath.substring(0, ftpPath.lastIndexOf("/"));
String[] dirs = ftpDir.split(