Requirement :
·
FTP hostname
·
Username and Password of FTP server
Features :
·
Android (local) and remote (FTP) file browsers.
·
Upload and download with resume support.
·
Folders selection support for upload, download
and delete.
Code for Upload file to FTP Server :
FTPClient ftp = new FTPClient();
System.out.println(ftp.connect(host)[0]);
ftp.login("username
of FTP", "password of FTP");
Log.v("log_tag",
"path : " + pat.getText().toString());
ftp.upload(new
java.io.File(pat.getText().toString()));
Code for Download from FTP Server :
FTPClient
ftp = new FTPClient();
System.out.println(ftp.connect(host)[0]);
ftp.login("username
of FTP", "password of FTP");
File
fileDownload = new File("/sdcard/testnew.xml");
fileDownload.createNewFile();
//
File.createTempFile("testnew", ".xml");
ftp.changeDirectory("dhaval");
//
ftp.download("testnew.xml", fileDownload);
ftp.download("testnew.xml",
fileDownload,
new
FTPDataTransferListener() {
public void
transferred(int arg0) {
Log.v("log_tag",
"This is for tranfer");
}
public void
started() {
// TODO
Auto-generated method stub
Log.v("log_tag",
"This is for started");
}
public void
failed() {
Log.v("log_tag",
"This is for failed");
}
public void
completed() {
Log.v("log_tag",
"This is for completed");
}
public void
aborted() {
Log.v("log_tag",
"This is for aborted");
}
});
Reference link
FTP jar : http://sourceforge.net/projects/ftp4j/
FTP jar : http://sourceforge.net/projects/ftp4j/
Hi can you upload a proyect please, it doesnt run on my eclipse but has no errorss!!
ReplyDeletethanks nice work that web
most welcome friend
DeleteFor load, error
ReplyDelete"Pat cannot be resolved"