Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TMS WebCopy Component Info

376 views
Skip to first unread message

Ed

unread,
Jan 2, 2005, 11:16:52 PM1/2/05
to
I need to upload a file via HTTP and I've read where TMSs
WebCopy will do this, but I can't find where you enter the
Login Name or Password.

Anyone know how to do this.

Thanks in Advance,

Ed


Pete Fraser

unread,
Jan 3, 2005, 10:02:51 AM1/3/05
to
Look on the web site under TWebCopy for an example:
FTP:
With WebCopy.Items.Add do
begin
FTPHost := ftp.tmssoftware.com
FTPUserID := 'myuserid';
FTPPassword := 'mypassword';
URL := 'webcopy.zip';
Protocol := wpFTP;
FileDate := EncodeDate(2002,3,18);
CopyNewerOnly := true;
TargetDir := 'c:\temp';
end;

HTH Pete

"Ed" <ebra...@selectqu.com> wrote in message
news:41d8...@newsgroups.borland.com...

Ed

unread,
Jan 3, 2005, 12:52:49 PM1/3/05
to
Thats FTP, I need HTTP.

Thanks,

Ed

"Pete Fraser" <pete....@frasersoft.nospam.com> wrote in message
news:41d966ca$1...@newsgroups.borland.com...

eshipman

unread,
Jan 3, 2005, 5:27:55 PM1/3/05
to
In article <41d9c3f1$1...@newsgroups.borland.com>,
pete....@frasersoft.nospam.com says...
> I don't believe that there is a login/password for http - unless you mean
> proxy server?
> Rgds Pete
>

Well, it depends on the serving site. If it expects a request from an
authorized user, there could be a number of ways to authenticate.
It could use htaccess, post params, even get params, which wouldn't be
very secure, BTW.

I, personally, would need more info about the server or site that I am
getting the file from and what it is expecting.

If it is expecting htaccess authentication, I am not sure how to do that
but if it is expecting get/post param authentication, that is easy to do
using idHTTP.

Pete Fraser

unread,
Jan 3, 2005, 3:30:24 PM1/3/05
to
I don't believe that there is a login/password for http - unless you mean
proxy server?
Rgds Pete

"Ed" <ebra...@selectqu.com> wrote in message

news:41d98585$1...@newsgroups.borland.com...

Mike Shkolnik

unread,
Jan 3, 2005, 5:36:22 PM1/3/05
to
> If it is expecting htaccess authentication, I am not sure how to do that
If you use the WinInet then just provide the userid+password in
InternetConnect function:
hInet := InternetOpen('any your agent', INTERNET_OPEN_TYPE_PROXY or
INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
hURL := InternetConnect(hInet,
PChar(yourURL),
INTERNET_DEFAULT_HTTP_PORT,
PChar(yourUserID),
PChar(yourPassword),
INTERNET_SERVICE_HTTP,
0,
0);
...
--
With best regards, Mike Shkolnik
E-mail: mshk...@scalabium.com
WEB: http://www.scalabium.com


Ed

unread,
Jan 3, 2005, 10:07:21 PM1/3/05
to
The website is hosted by HostLane.com. I manage the web-site
using MS FrontPage, but I upload my files via Network Places.
I enter www.mysite.com and the IE browser ask me for a user
name and password and I then use it just like the file explorer. The
address bar only says: www.mysite.com. Bruno had me try
http://username:pass...@mysite.com/ but that doesn't work either.

And HostLane has their head in the sand!

Thanks for the help,

Ed


eshipman

unread,
Jan 4, 2005, 9:13:18 AM1/4/05
to
In article <41da076d$1...@newsgroups.borland.com>, ebra...@selectqu.com
says...

IE has closed the security loophole that allowed the
http://username:pass...@mysite.com. It doesn't work in
Firefox, either.

Using the WinInet functions pointed out by Mike Shklonik
should work for you.

If you need a full demo, let me know.

Ed

unread,
Jan 4, 2005, 12:30:13 PM1/4/05
to
That would great if you have a full demo. I've been messing with this for 3
weeks now.

Thanks again,

Ed

"eshipman" <mr_delphi_developer@yahoo!!!.com> wrote in message
news:MPG.1c4460789...@forums.borland.com...

eshipman

unread,
Jan 4, 2005, 2:25:19 PM1/4/05
to
In article <41dad1a7$1...@newsgroups.borland.com>, ebra...@selectqu.com
says...

> That would great if you have a full demo. I've been messing with this for 3
> weeks now.
>
Not knowing the specifics of your site authentication, give this a try,
changing parameters as you see fit.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, WinInet, ExtCtrls, StdCtrls, JPEG;

type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure GetJpeg(AImage: TImage; AUserName, APassword, AURL:
String);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function GetFileWithUserPassword(AAppName, AUserName,
APassword, AURL: String): String;
const BufferSize = 1024;
var
Buffer: String;
BufferLen: DWORD;
hSession, hURL: HInternet;
bytesRead: DWORD;
s: String;
begin
Result:='';
hSession := InternetOpen(PChar(AAppName),
INTERNET_OPEN_TYPE_PRECONFIG or
INTERNET_OPEN_TYPE_PRECONFIG,
nil, nil, 0);
try
hURL := InternetConnect(hSession,
PChar(AURL),
INTERNET_DEFAULT_HTTP_PORT,
PChar(AUserName),
PChar(APassword),
INTERNET_SERVICE_HTTP,
0,
0);

if hURL <> nil then
begin
hURL := InternetOpenURL(hSession, PChar(AURL), nil,0,0,0);
try
s := '';
repeat
Buffer := '';
SetLength(Buffer, BufferSize);
InternetReadFile(hURL, PChar(Buffer), BufferSize, BufferLen);
SetLength(Buffer, BufferLen);
if (BufferLen <> 0) then
s := s + Buffer;
until (BufferLen = 0);
Result := s;
finally
InternetCloseHandle(hURL)
end;
end;
finally
InternetCloseHandle(hSession)
end;
end;

procedure TForm1.GetJpeg(AImage: TImage; AUserName, APassword, AURL:
String);
var
LStream: TStringStream;
LImage: TJpegImage;
s: String;
i: Integer;
begin
s := GetFileWithUserPassword(ExtractFileName(Application.ExeName),
AUserName,
APassword, AURL);
LStream := TStringStream.Create(s);
try
LImage := TJpegImage.create;
try
LImage.LoadFromStream(LStream);
AImage.picture.Assign(LImage);
finally
LImage.Free;
end;
finally
LStream.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
GetJpeg(Image1, 'Me', 'MyPassword',
'http://www.austinmetrobaseball.com/images/googlesearch.jpg');
end;

end.

Mike Shkolnik

unread,
Jan 4, 2005, 3:31:30 PM1/4/05
to
I think you meant the
hSession := InternetOpen(PChar(AAppName),
INTERNET_OPEN_TYPE_PROXY or
INTERNET_OPEN_TYPE_PRECONFIG,
nil, nil, 0);
...

--
With best regards, Mike Shkolnik
E-mail: mshk...@scalabium.com
WEB: http://www.scalabium.com

"eshipman" <mr_delphi_developer@yahoo!!!.com> wrote in message
news:MPG.1c44a9968...@forums.borland.com...

Ed

unread,
Jan 4, 2005, 8:06:41 PM1/4/05
to
It looks like you're 'Getting' a file via HTTP and I need to 'Put' a file
via HTTP.

Thanks,

Ed

eshipman

unread,
Jan 5, 2005, 9:12:09 AM1/5/05
to
In article <41db...@newsgroups.borland.com>, ebra...@selectqu.com
says...

> It looks like you're 'Getting' a file via HTTP and I need to 'Put' a file
> via HTTP.
>

Well, I guess I didn't read your post well enough, sorry...

Mike Shkolnik

unread,
Jan 5, 2005, 12:20:30 PM1/5/05
to
Ed,

just use the InternetWriteFile function instead InternetReadFile in posted
sample code

--
With best regards, Mike Shkolnik
E-mail: mshk...@scalabium.com
WEB: http://www.scalabium.com

"Ed" <ebra...@selectqu.com> wrote in message
news:41db...@newsgroups.borland.com...

0 new messages