Solved

Copy file from URL to my webserver

Posted on 2006-11-25
6
248 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API Soap Calls 4 87
FTP File permissions 1 45
Does it make sense migrate a website to MIcrosoft Azure 4 47
Remove third quote mark from widget 6 5
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

914 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now