Download file from internet

Spica

Registered User.
Local time
Today, 21:47
Joined
Aug 3, 2004
Messages
13
I would like to download a file from internet (pictures) and store them in my database.

E.g. I should be able to give the adress "http://www.myhomepage.se/me.jpg" and then this file should be saved somewhere on my harddrive.

Does anyone have any idea how this could be done?
 
I found some example code that does work:

Private Sub getFile(sSource As String, sDest As String)

Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2

Set oHTTP = CreateObject("Microsoft.XMLHTTP")
oHTTP.Open "GET", sSource, False
oHTTP.send
Set oStream = CreateObject("adodb.stream")

oStream.Type = adTypeBinary
oStream.Open
oStream.write oHTTP.responseBody
oStream.savetofile sDest, adSaveCreateOverWrite
Set oStream = Nothing
Set oHTTP = Nothing

End Sub
 

Users who are viewing this thread

Back
Top Bottom