大家好我将filezilla ftp服务器安装到我的电脑上。我试着在Android应用程序上传文件。但是,我收到的错误550是找不到目录,错误501是语法错误。我在互联网上搜索了一些但我找不到解决方案。请你帮助我好吗?这里还有FileZillaİnterface上的日志:
(000001)14.08.2012 14:36:07 - (not logged in) (192.168.10.179)> Connected, sending welcome message...
(000001)14.08.2012 14:36:07 - (not logged in) (192.168.10.179)> 220 FTP server' a hoşgeldiniz.
(000001)14.08.2012 14:36:07 - (not logged in) (192.168.10.179)> USER users
(000001)14.08.2012 14:36:07 - (not logged in) (192.168.10.179)> 331 Password required for users
(000001)14.08.2012 14:36:07 - (not logged in) (192.168.10.179)> PASS *******
(000001)14.08.2012 14:36:07 - users (192.168.10.179)> 230 Logged on
(000001)14.08.2012 14:36:07 - users (192.168.10.179)> CWD murat.alemdagtp
(000001)14.08.2012 14:36:07 - users (192.168.10.179)> 550 CWD failed. "/murat.alemdagtp": directory not found.
(000001)14.08.2012 14:36:07 - users (192.168.10.179)> TYPE I
(000001)14.08.2012 14:36:07 - users (192.168.10.179)> 200 Type set to I
(000001)14.08.2012 14:36:08 - users (192.168.10.179)> PASV
(000001)14.08.2012 14:36:08 - users (192.168.10.179)> 227 Entering Passive Mode (192,168,10,179,9,71)
(000001)14.08.2012 14:36:08 - users (192.168.10.179)> STOR
(000001)14.08.2012 14:36:08 - users (192.168.10.179)> 501 Syntax error
(000001)14.08.2012 14:36:09 - users (192.168.10.179)> QUIT
(000001)14.08.2012 14:36:09 - users (192.168.10.179)> 221 Goodbye
(000001)14.08.2012 14:36:09 - users (192.168.10.179)> disconnected.
以下是我的上传代码:
public Void doInBackground(Object... arg0)
{
String server = "192.168.10.179";
// TODO Auto-generated method stub
try
{
ftpClient.connect(server,21);
ftpClient.login("users", "1234567");
ftpClient.changeWorkingDirectory("murat.alemdag\ftp");
ftpClient.enterLocalPassiveMode();
FileInputStream in=new FileInputStream(file);
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.storeFile(filename, in);
publishProgress(100);
ftpClient.logout();
}
catch (Exception ex)
{
ex.printStackTrace();
}
return null;
}//end of doInBackground method
答案 0 :(得分:0)
请确保目录条目“murat.alemdagtp”存在。它似乎没有。您可以使用任何ftp客户端(如filezilla客户端)执行此操作,并记下登录后可以看到的目录,而不提供起始目录。
然后尝试使用正斜杠“/”提交路径,然后让我们看看它是否有效。
更新: 关于语法错误:STOR需要远程文件名作为参数。我在日志中看不到。看看这里:nsftools.com/tips/RawFTP.htm#STOR
请检查
中的变量文件名tpClient.storeFile(filename, in);
目前包含。