Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading without user intervention

Status
Not open for further replies.

mikestan

Technical User
Sep 10, 2003
2
0
0
AU
I need to be able to download an icon file to the local drive. (local permissions won't be a problem)

I have a file (eg ) And I need to place it locally in (eg C:\Program Files\myscript\icon.ico)

i want to use a script to do it all for the user autamically based on their form submission. I have the script up and running with the form submission. All communicating with the client but I can't find a way to download this icon without the "Save/Open" box appearing. The box isn't the issue rather the place where the illiterate user dumps the file. So I want to ensure the icon file is placed in the correct location (locally)
 
Hello mikestan,

This is how it can be done.
Code:
const adTypeBinary=1
const adSaveCreateOverwrite=2
const adModeReadWrite=3

filespec="C:\Program Files\myscript\icon.ico"

surl="[URL unfurl="true"]http://www.a-site.com/pics/icon.ico"[/URL]
strgt=filespec

set ohttp=createobject("Microsoft.XMLHTTP")
ohttp.open "GET", surl, false, "", ""
ohttp.send

set adostream=createobject("adodb.stream")
with adostream
	.type=adTypeBinary
	.mode=adModeReadWrite
	.open
	.write ohttp.responsebody
	.savetofile strgt, adSaveCreateOverwrite
	.close
end with
set adostream=nothing : set ohttp=nothing
wscript.echo "done"
(No error control implemented.)

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top