unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, WinInet;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
hopen, hconnect: HINTERNET;
implementation
{$R *.dfm}
function putfile(server, username, password, localfile, remotefile:
string; port: word = 21): boolean;
begin
hopen := InternetOpen('
myagent', INTERNET_OPEN_TYPE_DIRECT,
nil,
nil, 0);
hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
Result := FtpPutFile(hconnect, pchar(localfile), pchar(remotefile), FTP_TRANSFER_TYPE_UNKNOWN, 0);
InternetCloseHandle(hconnect);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if (
not (putfile('
ftp://matobe@matobe.ma.funpic.de', '
MaToBe', '
Pfadfinder2002', '
MHLog.ini', '
/MHLog.ini') ))
then
ShowMessage(SysErrorMessage(GetLastError));
end;
end.