在此之前,在项目中加上FTP的架包

【FTP】使用org.apache.commons.net.ftp.FTPClient 实现FTP的上传下载

 

第一步:配置FTP服务器的相关配置

FtpConfig.java  实体类(配置类)

 1 package com.sxd.ftp;
 2 
 3 public class FtpConfig {
 4      //主机ip  
 5     private String FtpHost = "192.168.18.252";  
 6     //端口号  
 7     private int FtpPort = 21;  
 8     //ftp用户名  
 9     private String FtpUser = "ftp";  
10     //ftp密码  
11     private String FtpPassword = "agenbiology";  
12     //ftp中的目录  这里先指定的根目录
13     private String FtpPath = "/";
14     
15     
16     
17     public String getFtpHost() {
18         return FtpHost;
19     }
20     public void setFtpHost(String ftpHost) {
21         FtpHost = ftpHost;
22     }
23     public int getFtpPort() {
24         return FtpPort;
25     }
26     public void setFtpPort(int ftpPort) {
27         FtpPort = ftpPort;
28     }
29     public String getFtpUser() {
30         return FtpUser;
31     }
32     public void setFtpUser(String ftpUser) {
33         FtpUser = ftpUser;
34     }
35     public String getFtpPassword() {
36         return FtpPassword;
37     }
38     public void setFtpPassword(String ftpPassword) {
39         FtpPassword = ftpPassword;
40     }
41     public String getFtpPath() {
42         return FtpPath;
43     }
44     public void setFtpPath(String ftpPath) {
45         FtpPath = ftpPath;
46     }  
47     
48     
49     
50 }
View Code

相关文章:

  • 2021-09-29
  • 2021-11-02
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-09
  • 2021-12-20
  • 2021-09-18
  • 2021-10-12
  • 2022-12-23
  • 2021-12-26
  • 2021-09-02
相关资源
相似解决方案