Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading Files From The Internet.

Status
Not open for further replies.

Snaples

Programmer
May 7, 2007
16
IL
I know you can do it with Borland Delphi 2006, using the Indy components. I also know there is an example of doing just that somewhere online. I just cant remember where!!

If you have the Indy components have a look on google, I think i searched:
delphi sending data over a network

Hope it helps

Gary
 
Thanks alot for you both.

I read and tried the About guide, but I dont get something.
Where is the file being saved?
How can I read from it?
Is it stored in a variable?

Thanks in advance.
 
this part of the code saves the file:

Code:
AssignFile(f, FileName) ;
   Rewrite(f,1) ;
   repeat
    InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
    BlockWrite(f, Buffer, BufferLen)
   until BufferLen = 0;
   CloseFile(f) ;
   result := True;

the function takes a filename as parameter so:

Code:
var
  internetFile,
  localFileName: string;
begin
 internetFile := '[URL unfurl="true"]http://z.about.com/6/g/delphi/b/index.xml';[/URL]
 localFileName := c:\temp\Feed.xml';

 if GetInetFile(internetFile, localFileName) then
   ShowMessage('Download successful.')
 else
   ShowMessage('Error in file download.') ;

will save ' into c:\temp\feed.xml

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top