0
我有这个代码通过FTP发送文件通过FTP的Android
FTPClient con = null;
try
{
con = new FTPClient();
con.connect("192.168.1.100");
if (con.login("gustavo", "gustavo"))
{
con.enterLocalPassiveMode(); // important!
con.setFileType(FTP.BINARY_FILE_TYPE);
String data = "/data/data/com.prosec/files/WhiteList.txt";
System.out.println("chguei aqui");
FileInputStream in = new FileInputStream(new File(data));
boolean result = con.storeFile("/data/data/com.prosec/files/WhiteList.txt", in);
in.close();
if (result) Log.v("upload result", "succeeded");
con.logout();
con.disconnect();
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("erro web");
}
发送的文件在我的FTP服务器,艾收到此消息
(000011)28/10/2015 12:50:16 - gustavo (192.168.1.101)> STOR /data/data/com.prosec/files/WhiteList.txt
(000011)28/10/2015 12:50:16 - gustavo (192.168.1.101)> 550 Filename invali
但该文件存在
PROSEC是我的包的名字,所以,我应该有接取/数据/数据/ PROSEC
我怎么能在这个直销发送文件保守党?
这样吗? String data =(ContextWrapper.getFilesDir()+“WhiteList.txt”); –
'String data = ContextWrapper.getFilesDir()+ WhiteList.txt;'不需要额外的括号。 - 确保你的文件名是正确的。 – vguzzi