使用ftpClient上传文件失败
我的系统是xp系统,自己建了个ftp服务器,使用ftpclient可以从ftp服务器上成功读取文件,但是使用ftpClient.storeFile上传没反应,没报错,文件目录下也没文件。请教各位大神,这是怎么回事儿,有没遇到过的System.out.println("start remote file create,开始上传文件到FTP:" + remotePath);
FTPClient ftpClient = config.buildFtpClient();
// 设置PassiveMode传输
ftpClient.enterLocalActiveMode();
// 设置以二进制流的方式传输
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
// 先把文件写在本地。在上传到FTP上最后在删除
is = new FileInputStream(file);
try {
//remotePath路径传输 是以.tmp格式传输到远程目录下
ftpClient.storeFile(remotePath, is);
//将远程目录下的文件.tmp格式改为.txt格式
ftpClient.rename(remotePath, toRemotePath);
} catch (Exception e) {
System.out.println(" file write in FTPServer error!! Path or network anomalies!!!!!!");
}
System.out.println("upload file success,上传文件到FTP成功");
// FTP主机服务器
private String host = "127.0.0.1";
// FTP端口 默认为21
private int port = 21;
// 本地上传文件临时保存路径
private String localPath = "E:/ftpServ/localpath/";
// FTP服务器文件保存路径
private String remotePath = "E:/ftpServ/";
// HR接口FTP服务器文件读取路径
private String remoteReadPath = "E:/ftpServ/";
这是我的ftp服务器参数配置。 ftpClient上传失败
补充:Java , Web 开发