![]() |
FTP, Datei in Ordner schreiben
Okay... Irgendwie bekomm ich es nicht hin, eine Datei in einen Ordner auf meinem FTP-Server upzuloaden!
So sieht die Funktion aus
Delphi-Quellcode:
Warum? Ahhh! :wall:
function UploadFolder(lpszServer, lpszUsername, lpszPassword, lpszLocalDirectory, lpszRemoteDirectory: String; wPort: Word = 21): Boolean;
var hOpen, hConnect: HINTERNET; begin Result := False; hOpen := InternetOpen('MyAgent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); if (hOpen <> nil) then begin hConnect := InternetConnect(hOpen, PChar(lpszServer), wPort, PChar(lpszUsername), PChar(lpszPassword), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); Result := FtpPutFile(hconnect, pchar(lpszLocalDirectory), pchar('/html/small/test.jpg'), //<-- test.jpg soll in den Ordner small, klappt aber nicht! FTP_TRANSFER_TYPE_UNKNOWN, 0); InternetCloseHandle(hConnect); InternetCloseHandle(hOpen); end end; |
Re: FTP, Datei in Ordner schreiben
Zitat:
Delphi-Quellcode:
so nicht funktioniert. Du musst erst mit
Result := FtpPutFile(hconnect, pchar(lpszLocalDirectory),
pchar('/html/small/test.jpg'), //<-- test.jpg soll in den Ordner small, klappt aber nicht! FTP_TRANSFER_TYPE_UNKNOWN, 0);
Delphi-Quellcode:
in das Verzeichnis wechseln.
FtpSetCurrentDirectory(hConnect, pchar('/html/small'));
Und dann lauten die Parameter für die Funktion FtpPutFile:
Delphi-Quellcode:
Gruß,
Result := FtpPutFile(hconnect, pchar(lpszLocalDirectory),
pchar('test.jpg'), FTP_TRANSFER_TYPE_BINARY, 0); Daniel |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz