我正在使用
FTPClient con = new FTPClient();
try
{
con.connect(HOST);
if (con.login (LOGIN, PASSWORD))
{
con.enterLocalPassiveMode();
InputStream instream = context.openFileInput(filename);
con.storeFile(filename, instream);
instream.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
con.logout();
con.disconnect();
}
Run Code Online (Sandbox Code Playgroud)
使用文本文件它可以工作.使用图像文件,图像非常奇怪:
怎么纠正呢?
尝试更改fileType:
con.setFileType(FTP.BINARY_FILE_TYPE)
Run Code Online (Sandbox Code Playgroud)
http://commons.apache.org/net/apidocs/org/apache/commons/net/ftp/FTPClient.html#setFileType%28int%29
归档时间: |
|
查看次数: |
2870 次 |
最近记录: |