i coded this program to upload a file on server using ftpput api it is not working it runs but file is not delevered!
here's the code:
unit ftp3;
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 declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var hInet, hConnect: HINTERNET;
local_file,
remote_file,
user,remote_server,
pass: pchar;
begin
local_file := 'C:\Documents and Settings\Omair\Desktop\loggen.txt';
remote_file := 'loggen.txt';
user := 'my user';
pass := 'my pass';
remote_server := ' ftp.drivehq.com';
hInet := InternetOpen(0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);
hConnect := InternetConnect(hInet,
remote_server,
INTERNET_DEFAULT_FTP_PORT,
user, pass,
INTERNET_SERVICE_FTP,
INTERNET_FLAG_PASSIVE,
0);
ftpPutFile(hConnect, local_file, remote_file, FTP_TRANSFER_TYPE_BINARY, 0);
InternetCloseHandle(hInet);
InternetCloseHandle(hConnect);
end;
end.