import com.enterprisedt.net.ftp.*; public class FTPUploader { public static void main(String[] args) { FTPClient client = new FTPClient(); try { client.setRemoteHost("ftp.example.com"); client.connect(); client.login("username", "password"); client.setType(FTPTransferType.BINARY); client.chdir("upload"); client.put("localfile.txt", "remotefile.txt"); client.quit(); } catch (FTPException e) { e.printStackTrace(); } finally { try { client.quit(); } catch (FTPException e) { e.printStackTrace(); } } } }


上一篇:
下一篇:
切换中文