最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
利用ADODB.Stream使用浏览器下载服务器文件
时间:2022-07-02 23:30:58 编辑:袖梨 来源:一聚教程网
download.asp?file=相对路径的文件
就可以把这个文件下载下来
<%
2
3 call downloadFile(replace(replace(Request("file"),"",""),"/",""))
4
5 Function downloadFile(strFile)
6 ' make sure you are on the latest MDAC version for this to work
7 ' -------------------------------------------------------------
8
9
10 ' get full path of specified file
11 strFilename = server.MapPath(strFile)
12
13
14 ' clear the buffer
15 Response.Buffer = True
16 Response.Clear
17
18 ' create stream
19 Set s = Server.CreateObject("ADODB.Stream")
20 s.Open
21
22 ' Set as binary
23 s.Type = 1
24
25 ' load in the file
26 on error resume next
27
28
29 ' check the file exists
30 Set fso = Server.CreateObject("Scripting.FileSystemObject")
31 if not fso.FileExists(strFilename) then
32 Response.Write("
就可以把这个文件下载下来
<%
2
3 call downloadFile(replace(replace(Request("file"),"",""),"/",""))
4
5 Function downloadFile(strFile)
6 ' make sure you are on the latest MDAC version for this to work
7 ' -------------------------------------------------------------
8
9
10 ' get full path of specified file
11 strFilename = server.MapPath(strFile)
12
13
14 ' clear the buffer
15 Response.Buffer = True
16 Response.Clear
17
18 ' create stream
19 Set s = Server.CreateObject("ADODB.Stream")
20 s.Open
21
22 ' Set as binary
23 s.Type = 1
24
25 ' load in the file
26 on error resume next
27
28
29 ' check the file exists
30 Set fso = Server.CreateObject("Scripting.FileSystemObject")
31 if not fso.FileExists(strFilename) then
32 Response.Write("
Error:
" & strFilename & " does not exist")
33 Response.End
34 end if
35
36
相关文章
- ZKJ、KOGE暴跌80%成积分“绞肉机”,币安Alpha还能玩吗? 06-16
- 《白荆回廊》鸢技能有哪些 06-16
- 盘点最热门正规数字资产全球交易所排行-低手续费现货交易所币安推荐 06-16
- 《交错战线》好友拜访有什么好的方法可用 06-16
- 《无期迷途》降临烙印深度介绍 06-16
- 最火2025币圈十大加密货币交易所榜单-最好用比特币交易app币安推荐 06-16