首页
资源
专题
注册
|
登录
当前位置:
网站首页
> 资源显示
asp
asp强制下载文件
发布时间:
2017/4/30 17:41:53 /
最后修改:
2017-4-30 17:42:28 /
浏览:
655
asp 强制下载文件
一般 PHP 代码不论免费还是收费空间运行都没有问题,不过 ASP 代码在绝大部分免费空间和一部分收费空间都不可能运行,因为那些空间关闭了 FSO 对象。
完整代码 (代码框可以往下拉高显示):
<% '========调用======== downloadFile("test/test.mdb") '---Down File--- Function downloadFile(strFile) ' get full path of specified file strFilename = server.MapPath(strFile) Response.Buffer = True Response.Clear Set s = Server.CreateObject("ADODB.Stream") s.Open s.Type = 1 on error resume next Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.FileExists(strFilename) then Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>") Response.End end if Set f = fso.GetFile(strFilename) intFilelength = f.size s.LoadFromFile(strFilename) if err then Response.Write("<h1>Error: </h1>" & err.Description & "<p>") Response.End end if Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name Response.AddHeader "Content-Length", intFilelength Response.CharSet = "UTF-8" Response.ContentType = "application/octet-stream" Response.BinaryWrite s.Read Response.Flush s.Close Set s = Nothing End Function %>
附件资源(免费)
您尚未登录,暂时无法查阅资源!
立即登录
插播广告区
发表评论
您尚未登录,暂时无法发表评论。
立即登录
暂无任何评论
推荐专题
更多专题
框架-插件集
ASP独立功能案例
ASP上传组件范例
编辑器插件详解
在线支付接口开发
常用广告轮换组件
常用在线客服组件
网页布局效果范例
ASP函数库汇总
ASP知识点详解
推荐资源
更多 >>
1
asp连接sqlite数据库代码!
2
ASP违禁词批处理V1.0_acces
3
关于height100和height1
4
aspJpeg_ASPS水印组件(安装
5
正文多图预览组件2(Viewer.js
6
正文多图预览组件(fancybox)
7
UNION多表联合查询,多表联合搜索问
8
jq隐藏table中的tr或td,防止
9
SQLServer2008数据库复制,
10
CSS解决长串英文字母显示不能自动换行
付费资源
更多 >>
1
ASP违禁词批处理V1.0_acces
2
A标签实现多选框赋值(限定选择个数)
3
云片网(短信验证码接入案例-ASP版本
4
模块选择(N个模块多选,每个模块可以选
5
多参数检索URL的参数处理(多条件查询
6
kindeditor_编辑器实战经验总
7
选择不同产品自动切换价格,价格切换JS
8
会员图像上传组件,flash上传头像剪
9
会员注册-登录-改密功能_gb2312
10
程序伪静态,URL静态化处理
广告区
CopyRight © 2017 www.kaifaku.cn All Rights Reserved - 版权所有 © 开发库 (所有资源来源于实战项目,拿来即用)
付费资源请联系 QQ:2633993818 / E-MAIL:2633993818@qq.com 本站免费分享资源不提供免费咨询