Solved

Copy file from URL to my webserver

Posted on 2006-11-25
6
250 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:logicmedia
  • 3
  • 2
6 Comments
 
LVL 5

Assisted Solution

by:jalalmegadeth
jalalmegadeth earned 350 total points
ID: 18011391
0
 

Author Comment

by:logicmedia
ID: 18011760
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...
0
 
LVL 5

Expert Comment

by:jalalmegadeth
ID: 18011797
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
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 28

Accepted Solution

by:
FishMonger earned 150 total points
ID: 18012340
An upload script doesn't make sense in this case.

I don't work with ASP, but if you're open to other options, here's a perl command that will download the file.

C:\>perl -MLWP::Simple -e "getstore('http://www.easyblog.dk/DSC00603.jpg', 'DSC00603.jpg')"


Here's the same thing in script form instead of command line.

#!c:/perl/bin/perl.exe

use LWP::Simple;
getstore('http://www.easyblog.dk/DSC00603.jpg', 'DSC00603.jpg');
0
 

Author Comment

by:logicmedia
ID: 18014702
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...

0
 
LVL 5

Expert Comment

by:jalalmegadeth
ID: 18014934
thx for points,
and thx for sharing your solution :))
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Please help me find a theme close to these two themes....... 9 61
Syntax for query to update table 2 29
Link failure 16 32
Why "Mobile First"? 5 18
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question