日期:2014-05-18 浏览次数:20904 次
String result = "上传处不成功";
if(list != null){
FTPClient ftpClient = new FTPClient();
FileInputStream fis = null;
int reply = 0;
try {
ftpClient.connect(loginInfo.getIP());
ftpClient.login(loginInfo.getAccount(), loginInfo.getPassword());
reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftpClient.disconnect();
System.out.println("FTP服务器 拒绝连接");
log.info("FTP服务器 拒绝连接");
return "FTP服务器 拒绝连接";
}
String srcFilePath = CircuitExcel(loginInfo.getDestPath(), list, FileName, loginInfo.getExcelPath());
String fileName = FileName.replace('/', '_')+".xls";
File srcFile = new File(srcFilePath + fileName);
fis = new FileInputStream(srcFile);
//设置上传目录
ftpClient.changeWorkingDirectory(loginInfo.getDestPath());
ftpClient.setBufferSize(1024);
ftpClient.setControlEncoding("GBK");
//设置文件类型(二进制)