3
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();
}
随着它工作的文本文件。随着图像文件,图像很奇怪:
如何纠正它吗?
哪一个FTP库您使用?尝试以二进制模式传输图像。 – Farhan
Common Apache 3.0.1 – J3n