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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download a File in VBScript

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
I have a link to a document in standard format:

I need to, from the webserver and from VBScript, download the document behind the scenes to a temp directory onto the local drive so that I have an absolute path (i.e. C:\temp\file.doc). My question is, how can I download this document from VBScript or via the browser via http? I can make a regular old hyperlink pointing to the document and manually download the file but I need to do this behind the scenes. Anyone have an idea?

Thanks,
bitwise
 
You do not have the ability from a webpage to have a user click a link, and save that file automatically to their hard drive. It's a security feature of the browsers. The only part of their hard drive you have semi-direct access to is their cookies file, and you cannot store documents there -- only cookies.

If it was a "trusted" application on an intranet or something, then you could write an ActiveX control that would do it -- but that's the only thing I can think of where you could do it "behind the scenes" so to speak.

penny.gif
penny.gif
 
Yes, this is an intranet application that is 100% Microsoft dependent. A matter a fact, the link is coming from Microsoft Sharepoint (a document management program), which is on a different server than the webserver. I thought about making an Activex control since I'm pretty good with those. I have messed with VBScripts FileSystemObject, but that really only deals with local file access. I can see how downloading a file behind the scenes from a webpage (aside from cookies) could be a really security problem, but I still hoped I could do it. :) Thanks, if you get any other ideas drop me a line.

bitwise
 
Oh yeah, I forgot to mention. Would the Windows Scripting Host stuff have any useful functionality for this problem? I haven't messed with it so if anyone has some keywords I could search on that would be helpful.

Thanks,
bitwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top