https://stackoverflow.com/questions/33042220/upload-file-to-ftp-server-using-indy
uses
...
OverbyteIcsFtpCli;
procedure FtpUploadFile(
HostName: String;
UserName: String;
Password: String;
UploadFileName: String;
ToHostDir : String );
var
FTP: TFtpClient;
begin
FTP := TFtpClient.Create(nil);
try
FTP.HostName := HostName;
FTP.Passive := True;
FTP.Binary := True;
FTP.Username := UserName;
FTP.Password := Password;
FTP.Port := '21';
if not FTP.Open then
raise Exception.Create('Failed to connect: ' + FTP.ErrorMessage);
if (not FTP.User) or (not FTP.Pass) then
raise Exception.Create('Failed to login: ' + FTP.ErrorMessage);
FTP.HostDirName := ToHostDir;
if not FTP.Cwd then
raise Exception.Create('Failed to change dir: ' + FTP.ErrorMessage);
FTP.LocalFileName := UploadFileName;
FTP.HostFileName := ExtractFileName(UploadFileName);
if not FTP.Put then
raise Exception.Create('Failed to upload file: ' + FTP.ErrorMessage);
finally
FTP.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FtpLoadFile('rubilaxe.hostoi.com',
'******', '******',
IncludeTrailingPathDelimiter(
ExtractFilePath(Application.ExeName) ) +'datafile.zip',
'/files' );
end;
http://beogradsko.blogspot.rs/2018/01/otvarac-kratko-uputstvo-za-instalaciju.html
No comments:
Post a Comment
Beogradsko programiranje=