Registriert seit: 9. Mär 2009
83 Beiträge
|
Re: Via FTP Datei hochladen
4. Apr 2009, 22:53
Wieso so kompliziert?
Delphi-Quellcode:
function putfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean;
var
hopen, hconnect: HINTERNET;
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;
Aufruf:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
putfile(ftpadresse, loginname, loginpw, 'C:\deinedatei.txt', 'deinedatei.txt')
end;
|
|
Zitat
|