Use ADODB. Stream to download server files in a browser

Source: Internet
Author: User
Download. asp? File = file in the relative path
You can download this file.
3 call downloadFile (replace (Request ("file "),"",""),"/",""))
5 Function downloadFile (strFile)
6 'make sure you are on the latest MDAC version for this to work
7 '-------------------------------------------------------------
10'get full path of specified file
11 strFilename = server. MapPath (strFile)
14 'clear the buffer
15 Response. Buffer = True
16 Response. Clear
18 'create stream
19 Set s = Server. CreateObject ("ADODB. Stream ")
20 s. Open
22 'set as binary
23 s. Type = 1
25 'load in the file
26 on error resume next
29 'check the file exists
30 Set fso = Server. CreateObject ("Scripting. FileSystemObject ")
31 if not fso. FileExists (strFilename) then
32 Response. Write ("33 Response. End
34 end if
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.