FTP upload dengan delphi
Bagi temen2 yang suka jaringan tentunya sudah paham apa itu http://FTP..kita disini tidak membahas apa itu FTP tapi akan kita bahas bagaimana membuat program FTP upload dengan delphi..dan perlu diketahui banyak program upload FTP misalnya WinSCP2..tapi apa salahnya kalo kita buat sendiri…nah langsung saja..yang perlu sipersipakan adalah komponen delphi untuk koneksi ke http://FTP..komponen ini disebut Ftp2Activex yang dapat didownload gratis di http://www.example-code.com…setelah diinstall ke delphi maka akan muncul pada tab activeX seperti gambar berikut …
nah..kemudian kita bikin formnya..sedehana saja,seperti gambar beriku ini..tulis listing dibawah ini,saat tombol BitBtn1 di clik..
procedure TForm1.Button1Click(Sender: TObject); var ftp: TChilkatFtp2; success: Integer; localFilename: String; remoteFilename: String; begin ftp := TChilkatFtp2.Create(Self); // Any string unlocks the component for the 1st 30-days. success := ftp.UnlockComponent('Anything for 30-day trial'); if (success <> 1) then begin ShowMessage(ftp.LastErrorText); end; ftp.Hostname := 'aegis'; //Server ftp.Username := '****'; ftp.Password := '****'; // The default data transfer mode is "Active" as opposed to "Passive". // Connect and login to the FTP server. success := ftp.Connect(); if (success <> 1) then begin ShowMessage(ftp.LastErrorText); end; // Change to the remote directory where the file will be uploaded. success := ftp.ChangeRemoteDir('/public_html'); //directori dimana file akan di upload if (success <> 1) then begin ShowMessage(ftp.LastErrorText); end; // Upload a file. localFilename := 'F:\project\WebcamDelphi\foto.gif'; remoteFilename := 'foto.gif'; success := ftp.PutFile(localFilename,remoteFilename); if (success <> 1) then begin ShowMessage(ftp.LastErrorText); end; ftp.Disconnect(); ShowMessage('File Uploaded!'); end; Pada program diatas server yang digunakan adalah aegis, folder penyimpanan di public_html dan file yang disimpan bernama foto.gif Jika file sukses di upload akan muncul pesan seperti gambar dibawah Semua sourcaode tadi ada di http://www.example-code.com...cuman ada perubahan di server dan direktori penyimpanan beseta file yang disimpan... OK...have a nice day :) Dany ....Belajar dan terus belajar...
Halo salam kenal mas..
saya tertarik sama ftp upload & donlod pada delphi
saya juga udah coba bikin, tapi waktu tombol upload ditekan kok mesti error terus yaa..
550 : file access denied (kira” tulisannya kayak itu).
kalo download sih udah berhasil..
tinggal uploadnya aja…
can U help me plz..
please email me : purezeroexe@yahoo.com
thousand thousand thousand thanks b4
Halo lagi..
maaf saya ralat posting saya..
hari ini saya udah bisa menyelesaikan program saya..
ternyata hanya kesalahan pada setting ftp servernya he hee.. maklum human error..
trims…
mas komponen FTP saya download http://www.example-code.com…
tapi yang mana satu mas.? komponennya
saya donwload malah saya dapat triel-30 hari di tulisannya mas katanya free..
mohon dibalas ya mas..
gan, beda FTP upload sama manual apa ya ?
@indobb -> FTP (file transfer protocol), salah satu protocol untuk transfer file baik upload/download..manual yg dimaksud apa ya??