For Programmers: Free Programming Magazines  


Home > Archive > ASP > November 2005 > save remote image to my server









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author save remote image to my server
Tim

2005-11-28, 7:55 am

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

McKirahan

2005-11-28, 6:55 pm

"Tim" <Citizen10Bears@gmail.com> wrote in message
news:1133178642.455067.62700@z14g2000cwz.googlegroups.com...
> 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."
%>


McKirahan

2005-11-28, 6:55 pm

"McKirahan" <News@McKirahan.com> wrote in message
news:BOGdnRs0W6Q3kBbenZ2dnUVZ_tadnZ2d@co
mcast.com...[color=darkred]
> "Tim" <Citizen10Bears@gmail.com> wrote in message
> news:1133178642.455067.62700@z14g2000cwz.googlegroups.com...

[snip]

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


McKirahan

2005-11-28, 6:55 pm

"McKirahan" <News@McKirahan.com> wrote in message
news:JLudnUVvI7pIhRbenZ2dnUVZ_tydnZ2d@co
mcast.com...
> "McKirahan" <News@McKirahan.com> wrote in message
> news:BOGdnRs0W6Q3kBbenZ2dnUVZ_tadnZ2d@co
mcast.com...
>
> [snip]
>
> I adapted it from a VBScript and forgot to change
> CreateObject
> to
> Sever.CreateObject


Server.CreateObject !


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com