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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a file using Inet1.OpenURL?

Status
Not open for further replies.

Jason231

MIS
Apr 15, 2006
43
0
0
NL
Hi all could any one show me how i can use Inet1.OpenURL to download a file from a either ftp or webserver and save it in harddrive. I mainly care about .rar file and .exe files.Thanks

 
One method:
Code:
Dim bytData() As Byte
Dim rPath as string, lPath as string, sFile as string
Dim iFile as Integer

rPath = "[URL unfurl="true"]http://www.com/"[/URL]
lPath = "c:\temp\"
sFile = "myfile.rar"

bytData() = Inet1.OpenURL(rPath & sFile, icByteArray)

iFile = FreeFile
Open lPath & sFile For Binary Access Write As #iFile
Put #iFile, bytData()
Close #iFile
 
Thank u for u nice code. But i get syntax error at :

Put #iFile, bytData()

Furthermore, how i can open the file after complete and how i can add prograss bar that shows number of bytes transfred ?I be happy if show me how.Thanks
 
oops, my fault. That line should read:
Put #iFile, ,byData()
Note the second comma.

I'm not sure if you can use a progress bar with the Inet control that way. Once you call the OpenURL method it doesn't execute any further until it finishes. So there's no way to check on the progress until it's already done and moves on. Unless somebody has a more advanced trick to using it?
 
>how i can add prograss bar that shows number of bytes transfred ?

See thread222-1096728.
 
petial thank u for pointing me to that nice code of u. But unfortuently i could not run it. I tried it on downloading a winrar file once i click nothing happens and the file could not get dowloaded. Could u tell me what i am doing wrong.I put all the controles and components right but still no luck.Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top