大家好,我正在尝试使用 apache commons ftpclient 上传一个像 4mb 这样的小文件,它不会上传我的文件并且没有给我任何错误,并说上传成功这是我的代码,请提前帮助我thanx ..这里是代码。 .
new Thread(new Runnable() {
public void run() {
Looper.prepare();
FTPClient client = new FTPClient();
try {
boolean result = false;
FileInputStream fis = null;
client.connect(server);
client.enterLocalPassiveMode();
client.login(user, pass);
client.makeDirectory("/public_html/"+str); ///str is a name of remote folder
client.setFileType(FTP.BINARY_FILE_TYPE);
client.setFileTransferMode(FTP.BINARY_FILE_TYPE );
client.changeWorkingDirectory(str);
String path1 = Environment.getExternalStorageDirectory() + "/index.htm";
File f = new File(path1);
String testname = f.getName();
fis = new
FileInputStream(f);
result = client.storeFile(testname, fis);
if (result == true){
Log.v("upload","upload successfull");
}
else{
Log.v("upload", "upload failed");
}
catch (Exception e) {
e.printStacktrace();
}
}
}).start();