delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (7)


Downloading FilesFormat this article printer-friendly!Bookmark function is only available for registered users!
Simple way to download a file from the net.
Product:
Delphi all versions
Category:
Communication
Skill Level:
Scoring:
Last Update:
12/01/2001
Search Keys:
delphi delphi3000 article borland vcl code-snippet Download File Net
Times Scored:
14
Visits:
7813
Uploader: Bradley Baumann
Company:
Reference: Bradley Baumann
 
Question/Problem/Abstract:
How do i download a file (with code)
Answer:



Seems as if not too many people know about the great URLMon (included with delphi)... Heres a quick example that will download index.html from www.scrapcode.com, to c:\ :


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, URLMon;

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);
begin
     URLDownloadToFile(nil, 'http://www.scrapcode.com/index.html', 'c:\index.html', 0, nil);
end;

end.









Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Downloading files
    Maarten de Haan (Dec 7 2001 3:01PM)

See: http://community.borland.com/article/0,1410,27704,00.html
Respond

RE: Downloading files
Lutfi Baran (Aug 16 2002 7:18PM)

Also see: http://www.delphi3000.com/articles/article_1673.asp
Respond

Very good tip!
    Frederico Pissarra (Dec 6 2001 2:06PM)

Thanks for the tip!
Do you know something about URLMon and HTTPS?
Respond

Good Tip
    Wha Badah (Dec 2 2001 4:41AM)

Hey, nice trick ! damn usefull!
:)
this is the kind of article I like to read
Respond

RE: Good Tip
Bradley Baumann (Dec 2 2001 5:14PM)

Thanks! I'm glad you enjoy it :-)
Respond

tips
haiseb haiseb (Dec 6 2001 5:12AM)

Straight forward...
I am wondering about the last Paramter?
Can you use it instead of nil
Thanks
haiseb



Respond

RE: tips
stefan hagel (Dec 6 2001 11:12AM)

See
msdn.microsoft.com/workshop/networking/moniker/reference/ functions/URLDownloadToFile.asp
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


   


  Community Ad of
E. DSpirito
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)