save remote image to my server

Discussion in 'ASP General' started by Tim, Nov 28, 2005.

  1. Tim

    Tim Guest

    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
     
    Tim, Nov 28, 2005
    #1
    1. Advertising

  2. Tim

    McKirahan Guest

    "Tim" <> wrote in message
    news:...
    > 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, Nov 28, 2005
    #2
    1. Advertising

  3. Tim

    McKirahan Guest

    "McKirahan" <> wrote in message
    news:...
    > "Tim" <> wrote in message
    > news:...
    > > 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


    [snip]

    I adapted it from a VBScript and forgot to change
    CreateObject
    to
    Sever.CreateObject
     
    McKirahan, Nov 28, 2005
    #3
  4. Tim

    McKirahan Guest

    "McKirahan" <> wrote in message
    news:...
    > "McKirahan" <> wrote in message
    > news:...
    > > "Tim" <> wrote in message
    > > news:...
    > > > 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

    >
    > [snip]
    >
    > I adapted it from a VBScript and forgot to change
    > CreateObject
    > to
    > Sever.CreateObject


    Server.CreateObject !
     
    McKirahan, Nov 28, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike John
    Replies:
    0
    Views:
    538
    Mike John
    Jul 28, 2003
  2. Daniel Mark
    Replies:
    1
    Views:
    790
    Fredrik Lundh
    Sep 25, 2006
  3. dodgeyb
    Replies:
    1
    Views:
    630
    George Ter-Saakov
    Dec 14, 2007
  4. RichB
    Replies:
    4
    Views:
    1,137
    Steven Cheng
    Mar 20, 2008
  5. T.Jeywin Lizy

    How to save an XML Doc in remote server

    T.Jeywin Lizy, Mar 24, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    1,596
Loading...

Share This Page