的Java文件上傳我上傳文件到服務器,但該文件是空的。(大小零字節)通過ftp零字節錯誤
int reply;
ftp.connect(server,215);
ftp.login(username, Password);
System.out.println("Connected to " + server + ".");
System.out.print(ftp.getReplyString());
reply = ftp.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
System.err.println("FTP server refused connection.");
}
System.out.println("FTP server connected.");
ftp.setFileType(FTP.BINARY_FILE_TYPE);
ftp.enterLocalPassiveMode();
InputStream input= new FileInputStream(source_file_path);
ftp.storeFile(dest_dir, input);
System.out.println(ftp.storeFile(dest_dir, input));
System.out.println(ftp.getReplyString());
input.close();
ftp.logout();