0
我一直在尋找相當一段時間,找不到解決方案。 我試圖從我的電腦上傳文件到我的ftp服務器。但每次我嘗試,我只創建一個0kb文件。上傳後的Proftpd - 0kb文件
我試圖
- 夾在開啓防火牆斷開
- 搭配chmod -R 775
- 20不同版本的客戶端
- 被動傳輸模式
- 二進制文件類型的
- 二進制類型傳輸模式
- 使用最新的commons-n等libary(3.3)
相關:
0 kb file created once FTP is done in java
FTP a file to server, but it the result arrives with zero byte size
public static void goforIt(){
FTPClient ftpClient = new FTPClient();
ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
try {
ftpClient.connect("xxx.xxx.xxx.xx");
ftpClient.login("xx", "xx");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
//ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE);
ftpClient.enterLocalPassiveMode();
boolean w = ftpClient.changeWorkingDirectory("/var/www/xx");
if (ftpClient.getReplyString().contains("250")) {
InputStream in = null;
try{
in = new FileInputStream(new File("xx.mp4"));
}catch (Exception e){
e.printStackTrace();
return;
}
ftpClient.sendCommand("PWD");
boolean result = ftpClient.storeFile("/var/www/public_videos/xx.mp4", in);
System.out.println(ftpClient.getReplyString() + result);
in.close();
ftpClient.logout();
ftpClient.disconnect();
}
} catch (SocketException e) {
e.printStackTrace();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
日誌:
220 ProFTPD 1.3.4a Server (Debian) [::ffff:xx.xxx.xx.xx]
USER xx
331 Password required for xx
PASS xx
230 User xx logged in
TYPE I
200 Type set to I
CWD /var/www/xx
250 CWD command successful
PWD
257 "/var/www/xx" is the current directory
PASV
227 Entering Passive Mode (xx,xx,xx,xxx,xxx,xx).
STOR /var/www/public_videos/xx.mp4
150 Opening BINARY mode data connection for /var/www/xx/xx.mp4
226 Transfer complete
226 Transfer complete
true
QUIT
221 Goodbye.
結果:
http://puu.sh/e6pVx/051c175f9e.png
任何幫助的解決方案?請 :? – Totenfluch