大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

asp强制下载函数

ASP 代码:
<%
========调用========

创新互联专注于鸡泽企业网站建设,成都响应式网站建设公司,商城网站建设。鸡泽网站建设公司,为鸡泽等地区提供建站服务。全流程定制网站设计,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务


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("

Error:

" & strFilename & " does not exist

")
Response.End
end if
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("

Error:

" & err.Description & "

")
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强制下载函数
URL网址:http://dzwzjz.com/article/sshcdo.html
在线咨询
服务热线
服务热线:028-86922220
TOP