Kod: Tümünü seç
unit FtpUpload;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, wininet;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
intconn,intopen : hinternet;
implementation
{$R *.dfm}
procedure UploadMyFile (File2Upload:pchar; targetfilename:pchar);
const
TheFtpPort=21;
begin
intopen := internetopen('iexplore',INTERNET_OPEN_TYPE_DIRECT,nil,nil,0);
intconn := internetconnect(intopen,'ftp.site.com',TheFtpPort,'kullanıcı_adı','sifre',INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);
sleep(100);
ftpputfile(intconn,File2Upload,targetfilename,FTP_TRANSFER_TYPE_UNKNOWN,0);
internetclosehandle(intconn);
internetclosehandle(intopen) ;
END;
//Kullanımı
procedure TForm1.Button1Click(Sender: TObject);
begin
uploadmyfile('önemliler.txt', 'index.html');
end;
end.