FTP upload dengan delphi
nah..kemudian kita bikin formnya..sedehana saja 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 Semua sourcaode tadi ada di http://www.example-code.com...cuman ada perubahan di server dan direktori penyimpanan beseta file yang disimpan...
Komentar
Posting Komentar