我的原始zip文件是4KB。当我通过服务器上的ftp上传它,大小较小,即3.032KB.it似乎我的zip文件已损坏,无法打开。为什么会这样?怎么修好?
ftp代码
public static void uploadFilesToServer(String filename){
File file = new File(filename);
FTPClient client = new FTPClient();
FileInputStream fis = null;
try {
client.connect("ftpsrv2.koln.de");
client.login("user", "pass");
client.setFileType(FTP.BINARY_FILE_TYPE);
fis = new FileInputStream(filename);
if(client.storeFile(file.getName(), fis)){
System.out.println("Upload success");
}else{
System.out.println("Upload faild");
}
client.logout();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}