1.先设置ftp
2.打开服务
3.设置站点
4.起名字
这样就可以了
5.剩下的就是设置权限和账号了,找到对应的按钮就可以了
6.下载文件的代码
public byte[] downloadFile(File file) throws IOException{ByteArrayOutputStream out = new ByteArrayOutputStream();toDir(file.getParent());client.retrieveFile(new String(file.getName().getBytes(),"ISO-8859-1"), out);byte[] data = out.toByteArray();if(data.length == 0){throw new IOException("ftp文件未找到");}out.close();return data;}public class MtFtp {public static void main(String[] args) throws Exception {ApacheFtpClient client = new ApacheFtpClient("10.10.10.10", 21, true);client.login("ftp","bai123456");client.setting();client.dirRoot();byte[] data = client.downloadFile(new File("/a/b/c/test.pdf"));FileOutputStream oo = new FileOutputStream("D:/imgTest/测试.pdf");oo.write(data);oo.flush();oo.close();}
}