Link to home
Start Free TrialLog in
Avatar of logicmedia
logicmedia

asked on

Copy file from URL to my webserver

A simpel question:

Say I have an URL to an image e.g. www.easyblog.dk/DSC00603.jpg. How do I "copy" that imagefile an save it on my webserver using normal ASP

- thomas
SOLUTION
Avatar of jalalmegadeth
jalalmegadeth

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
Avatar of logicmedia
logicmedia

ASKER

no it's rather a download. I have a link to an image which I want to display on my page. But I do not want to refer to it in its current location. I want to copy that image to my own server from what webserver its on and save it on my own server and then display it. So you could say I want my ASP script to download a file from an URL location...
yeah it'S the same thing

an upload script can do the trick, u have just to specify the file location (local or on the internet) in your case the file is already on the internet
ASKER CERTIFIED SOLUTION
Avatar of FishMonger
FishMonger
Flag of United States of America image

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
Okay I found a way... The upload thing seemed overkill and requires the use of a component on the webserver. So in my search for components on my webserver I found the aspHTTP component. It does the job easily:

      Set HttpObj = Server.CreateObject("AspHTTP.Conn")
      HttpObj.Url = arrImg(i)
      HttpObj.FollowRedirects = True
      HttpObj.RequestMethod = "GET"
      HttpObj.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"
      HTTPObj.SaveFileTo = server.MapPath(filepath & filename)
      HttpObj.GetURL
      Set HttpObj = nothing

And its saved...

I'm handing out the points anyways - gonna split them.

Thanks for your time guys...

thx for points,
and thx for sharing your solution :))