menembus batas impian


import org.apache.commons.net.*;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;

// copy code di bawah ini ke EVENT swing control , dapat di costumize terserah agan😀

String hostName = “www.google.com / 193.45.355.34”; //contoh domain
String username = “user”;
String password = “password”;
String location = “C:\\Documents and Settings\\strikersz7\\Desktop\\testfileupload.txt”; // file yang akan diupload

FTPClient ftp = null;

ftp = new FTPClient();
ftp.connect(hostName);
ftp.login(username, password);

ftp.setFileType(FTP.BINARY_FILE_TYPE);
int reply = ftp.getReplyCode();
if(FTPReply.isPositiveCompletion(reply)){
System.out.println(“Connected Success”);
System.out.println(“Write File Upload logic”);
}

File f1 = new File(location);
FileInputStream in = new FileInputStream(f1);
ftp.storeFile(“cacad2.mpeg”,in); // write nama file ke direktory server
System.out.println(“Upload File Success”);
ftp.logout();

silahkan coba

Comments on: "source code baru upload file to server" (1)

  1. gan minta source codenya lengkap bisa gan,.lgi butuh gan buat tugas,.
    trimkasih

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: