Results 1 to 5 of 5

Thread: Script to save a picture(download to pc) then upload it to (FTP)

  1. #1

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Script to save a picture(download to pc) then upload it to (FTP)

    I need help on a script.. (actually all of it since I really have never done scripts before)

    I have added a right click menu option to "Add to smiles" for IE.

    I need to be able to save the picture to a certain folder.. then upload it to my web site... I dont have a clue where to start or how to do this?

    Help?

    Thanks!
    Last edited by Static; May 3rd, 2006 at 01:39 PM.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Script to save a picture and upload it...

    Partially resolved... I have gotten it to download/save to my folder...
    now I need to upload it to web web page...

    [Highlight=VB]
    <SCRIPT LANGUAGE = "VBScript">
    Dim oWindow,oDocument,oSelect,oSelectRange
    Set oWindow = window.external.menuArguments
    Set oSource = oWindow.event.srcElement
    if right(oSource.href,3) = "gif" then
    fName = right(oSource.href,len(oSource.href)-instrrev(oSource.href,"/"))
    Dim oXmlHttp, oStream
    Set oXmlHttp = CreateObject("Msxml2.ServerXmlHttp.4.0")
    Set oStream = CreateObject("ADODB.Stream")
    oXmlHttp.open "GET",oSource.href,False
    oXmlHttp.send
    if oXmlHttp.status = 200 Then
    oStream.Type = 1
    oStream.Open
    oStream.write oXmlHttp.responsebody
    oStream.SaveToFile "c:\VB\VBF4\smiles\" & fName
    oStream.Close
    End If
    Set oXmlHttp = Nothing
    Set oStream = Nothing
    oWindow.alert "File: " & fName & " Saved...."
    else
    oWindow.alert "That is not a gif image"
    end if
    </SCRIPT>
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Hyperactive Member Private_sub's Avatar
    Join Date
    Nov 2005
    Location
    +31
    Posts
    368

    Re: Script to save a picture and upload it...


  4. #4

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Script to save a picture and upload it...

    but isnt that stuff done server side??
    I need clientside...
    like this: which only works sometimes:

    (sometimes it says still executing....) Help?


    VB Code:
    1. <SCRIPT LANGUAGE = "VBScript">
    2. Dim oWindow,oSource,inet
    3. Set oWindow = window.external.menuArguments
    4. Set oSource = oWindow.event.srcElement
    5. [B]set inet = CreateObject("InetCtls.Inet.1")[/B]
    6. if right(oSource.href,3) = "gif" then
    7.     fName = right(oSource.href,len(oSource.href)-instrrev(oSource.href,"/"))
    8.     Dim oXmlHttp, oStream
    9.     Set oXmlHttp = CreateObject("Msxml2.ServerXmlHttp.4.0")
    10.     Set oStream = CreateObject("ADODB.Stream")
    11.     oXmlHttp.open "GET",oSource.href,False
    12.     oXmlHttp.send
    13.     if oXmlHttp.status = 200 Then
    14.      oStream.Type = 1
    15.      oStream.Open
    16.      oStream.write oXmlHttp.responsebody
    17.      oStream.SaveToFile "c:\VB\VBF4\smiles\" & fName
    18.      oStream.Close
    19.     End if
    20.     Set oXmlHttp = Nothing
    21.     Set oStream = Nothing
    22.     inet.remotehost = "home.rochester.rr.com"
    23.     inet.username = "xxxxxxx"
    24.     inet.Password = "xxxxx"
    25.     inet.protocol = 2
    26.     [B]inet.execute , "PUT c:\VB\VBF4\smiles\" & fName & " smiles/" & fName[/B]
    27.     inet.execute , "CLOSE"
    28.     oWindow.alert "File: " & fName & " Saved!"
    29. else
    30.     oWindow.alert "That is not a gif image"
    31. end if
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Script to save a picture and upload it...

    ok it seems to work except this line causes a script error

    oStream.SaveToFile "c:\VB\VBF4\smiles\" & fName

    (But it works? the file saves and uploads but it says...
    Unknown runtime error
    Line 17
    char 3
    url: file://C:\VB\VBF4\image.htm
    ??

    why would it work.. but not work??
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width