Link to home
Start Free TrialLog in
Avatar of paulnamroud
paulnamroud

asked on

Vb.Net - Copy an image from a URL to a specific path ???

Hi everyone,

I need your help.

I'm writing a Vb.Net application which should copy many images (images001.jpg, images002.jpg...) from an URL address (i.e http://mysite.com/images/images001.jpg).

I don't know how to copy each image from the URL address (i.e http://mysite.com/images/) to a network path (i.e \\MyNetwork\Images\).

I had already found on internet a code which allow me to check the existence of any image giving a URL address.

Can anyone tell me how to copy an image from a URL to a specific path ?

Thank you.

Paul


    Function ImageExiste(ByVal p_url As String) As Boolean

        Dim xmlHttp
        xmlHttp = CreateObject("Microsoft.xmlHttp")
        xmlHttp.Open("GET", p_url, False)
        xmlHttp.Send()

        Select Case xmlHttp.status

            Case 200 'found
                ImageExiste = True

            Case 404 'Not found
                ImageExiste = False

            Case Else 'Some other problem
                ImageExiste = False

        End Select

        'ImageExiste = xmlHttp.Status
        xmlHttp = Nothing

    End Function



Avatar of gangwisch
gangwisch

Dim w As New WebClient
        w.DownloadFile(address, filename)
Avatar of paulnamroud

ASKER

Sorry, but it didn't work the method you gave me ...
ASKER CERTIFIED SOLUTION
Avatar of dave_moats
dave_moats

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think the points should be split between myself and dave_moats.
I think Kinger's suggestion is valid as both solutions can be used to answer the question.
I agree.