HTTPget from utilmind?

lundorff
lundorff used Ask the Experts™
on
Hallo,
I would like if someone could tell me something about the HTTPget combonent from utilmind. (http://www.utilmind.com/delphi/httpget.zip)

1) When saving a file using HTTPGet1.FileName := 'filename.txt' the file is saved by the name i just wrote 'filename.txt'. Is there any way to save a file by its default name?

2) Location and path! How do I specify in which folder the active file can be saved to? Rigth now it saves to the foldes with the executing file.

Rgs
Lund
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
perhaps something like this? (just a function that I typed without really testing it in Delphi, heh).

function GetFileNameFromURL(const S: string): string;
var
  i: Integer;
begin
  Result := S;
  for i := Length(S) downto 1 do
    if (S[i] = '/') then
    begin
      Result := Copy(S, i + 1, Length(S));
      Break;
    end;
  i := Pos('?', Result);
  if i > 0 then
    Result := Copy(Result, 1, i - 1);
end;

So when you type
HTTPGet1.URL := 'http://www.mysite.com/getfile.php?username=xxx';

you can also have
HTTPGet.FileName := GetFileNameFromURL('http://www.mysite.com/getfile.php?username=xxx');

For Question #2, you can have it this way:

HTTPGet.FileName := 'C:\MyFolder\' + GetFileNameFromURL('http://www.mysite.com/getfile.php?username=xxx');



HTH
DragonSlayer

Author

Commented:
Sorry m8 - I'm new to this place so I thought I allready had given you the points
it's alrite :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial