save remote image to my server

T

Tim

Hi all,

I would like to reference a remote image, such as
http://www.mysite.com/pic.jpg and save it to a local folder such as
c:\pics

Can this be done with ASP?

I have played with many image manipulation components and none of them
perform this fuction.

Thanks in advance

Tim
 
M

McKirahan

Tim said:
Hi all,

I would like to reference a remote image, such as
http://www.mysite.com/pic.jpg and save it to a local folder such as
c:\pics

Can this be done with ASP?

I have played with many image manipulation components and none of them
perform this fuction.

Thanks in advance

Tim

Will this help? Watch for word-wrap.


<% Option Explicit
'*
'* Declare Constants
'*
Const cFIL = "pic.jpg"
Const cOUT = "c:\pics\"
Const cURL = "http://www.mysite.com/"
'*
'* Fetch File
'*
Dim objXML
'Set objXML = CreateObject("MSXML2.XMLHTTP")
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET", cURL & cFIL, False
objXML.Send
Dim binXML
binXML = objXML.ResponseBody
Set objXML = Nothing
'*
'* Save File
'*
Dim objADO
Set objADO = CreateObject("ADODB.Stream")
objADO.Type = 1
objADO.Open
objADO.Write binXML
objADO.SaveToFile cOUT & cFIL,2
Set objADO = Nothing
'*
'* Finish
'*
Response.Write cFIL & " downloaded."
%>
 
M

McKirahan

[snip]

I adapted it from a VBScript and forgot to change
CreateObject
to
Sever.CreateObject
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top