DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to download a file from the web?

 
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
Tronix
Member


Joined: 18 Jan 2005
Posts: 3
Location: DK - Denmark

PostPosted: 18/01/05 12:15    Post subject: How to download a file from the web? Reply with quote

Hey! I couldn't find this subject in any thread so here goes:

I want to write an application (in Delphi) that can download certain files from a web-site.

Fx. If the user press a button the program downloads www.some-url.com/somefile.dat and saves it on the HD.

How do I do that?

/Valdemar
Back to top
View user's profile Send e-mail Visit poster's website
Stefan
Junior Member


Joined: 27 Sep 2004
Posts: 61
Location: Netherlands

PostPosted: 18/01/05 20:21    Post subject: Reply with quote

Hi,

You could use Indy (look for that on google) or use the Microsoft provided DLL's, for that take a look on:

http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/reference/functions/urldownloadtofile.asp

which is, I believe, declared in urlmon.pas...

Cheers,
Stefan

ps. If you need specific code, I'll be able to provide some of it as I've worked with this before, but I won't be able to acces the code untill tomorrow...
Back to top
View user's profile Send e-mail
Tronix
Member


Joined: 18 Jan 2005
Posts: 3
Location: DK - Denmark

PostPosted: 19/01/05 11:03    Post subject: Reply with quote

a little source would be nice..

I tried the urlmon module, but I get the BindStatusCallback.OnProgress()-function to work correctly

\Valdemar
Back to top
View user's profile Send e-mail Visit poster's website
Stefan
Junior Member


Joined: 27 Sep 2004
Posts: 61
Location: Netherlands

PostPosted: 19/01/05 11:22    Post subject: Reply with quote

alrighty...

http://groups.google.nl/groups?q=Delphi+URLDownloadToFile+bsc&hl;=nl&lr;=&selm;=cscem4%24hm7%241%40inews.gazeta.pl&rnum;=1

I'm not on my laptop right now so I can't acces my code, but that's some useful code showing how to work with the IBindStatusCallBack interface...

Cheers,
S
Back to top
View user's profile Send e-mail
Tronix
Member


Joined: 18 Jan 2005
Posts: 3
Location: DK - Denmark

PostPosted: 19/01/05 11:30    Post subject: Reply with quote

That works perfect...

Thank you very much!

\Valdemar
Back to top
View user's profile Send e-mail Visit poster's website
Stefan
Junior Member


Joined: 27 Sep 2004
Posts: 61
Location: Netherlands

PostPosted: 19/01/05 11:42    Post subject: Reply with quote

Please keep in mind that there might be more to it than this.
When downloading via Internet Explorer you get all the "nice features" included, like caching for instance:

Suppose you download "program.exe" twice; first time it's version 1.0 and the second time it's version 2.0; second time IE might just "download" the cached version 1.0 and not the intended version 2.0...

Apart from that I've found downloading via proxies doesn't always work and if the user doesn't use IE and therefor his/hers settings in IE are screwed up, you will not be able to download either...

Cheers,
Stefan
Back to top
View user's profile Send e-mail
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group