PDA

Click to See Complete Forum and Search --> : grab image from internet


matcathy
Jan 3rd, 2000, 12:49 PM
Given a web address which contain an image (different image on everyday). Is it possible to download the image and save to a specific location on harddrive?
Thanks.

Mark Sreeves
Jan 3rd, 2000, 03:22 PM
yes!

put an internet transfer control and a command button onto a form and paste this in:

(it's a picture of me)


Private Sub Command1_Click()
Dim localFile As String
Dim remoteFile As String
Dim fNum As Long
Dim b() As Byte

remoteFile = "http://graffiti.virgin.net/dms.mbs/images/mark.jpg"
localFile = "C:\temp\mark.jpg"


fNum = FreeFile
' Retrieve the file as a byte array.
b() = Inet1.OpenURL(remoteFile, icByteArray)

Open localFile For Binary As #fNum
Put #fNum, , b()
Close #fNum
MsgBox "Done"
End Sub


------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company