关于文件下载
2004-08-11 14:35
369 查看
<%
function dl(f,n)
on error resume next
Dim S
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(server.mappath(f))
if Err.Number>0 then
Response.Status="404"
else
Response.ContentType="application/*"
Response.AddHeader "Content-Disposition:","attachment; filename=" & n
Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
if Range="" then
Response.BinaryWrite(S.Read)
else
'S.position=Clng(Split(Range,"-")(0))
Response.BinaryWrite(S.Read)
End if
end if
Response.End
end function
If request("action")="down" Then
call dl(request("path"),"aa.gif")
End If
%>
<img src=index.gif>
<a href=?action=down&path=index.gif>点击下载此图片</a>
<SCRIPT language=JavaScript>
function aa(tt)
{
var wp = window.open(tt.src,"","width=100,height=100");
wp.document.execCommand("saveAs");
}
</SCRIPT>
<IMG onclick=aa(this) alt=单击保存 src="../face/0001.gif" border=0>
function dl(f,n)
on error resume next
Dim S
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(server.mappath(f))
if Err.Number>0 then
Response.Status="404"
else
Response.ContentType="application/*"
Response.AddHeader "Content-Disposition:","attachment; filename=" & n
Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
if Range="" then
Response.BinaryWrite(S.Read)
else
'S.position=Clng(Split(Range,"-")(0))
Response.BinaryWrite(S.Read)
End if
end if
Response.End
end function
If request("action")="down" Then
call dl(request("path"),"aa.gif")
End If
%>
<img src=index.gif>
<a href=?action=down&path=index.gif>点击下载此图片</a>
<SCRIPT language=JavaScript>
function aa(tt)
{
var wp = window.open(tt.src,"","width=100,height=100");
wp.document.execCommand("saveAs");
}
</SCRIPT>
<IMG onclick=aa(this) alt=单击保存 src="../face/0001.gif" border=0>
相关文章推荐
- 关于文件上传(去重名)和文件下载
- 关于创建Excel表格问题(保存至指定文件/弹出直接打开还是下载,并可以选择保存路径的对话框)
- 关于tp3.2.3文件导入数据库(去除重复数据)、写日志和下载问题
- 关于网页下载FTP里面的文件相关
- 关于如何让页面同时下载多个文件的尝试
- 关于文件下载
- 关于下载文件的权限
- 关于Struts2 文件上传下载
- 关于通过ajax发送请求下载csv文件双击乱码
- 关于文件下载出现乱码问题
- 关于io流下载文件经常遇到open failed: EISDIR (Is a directory)
- Android中关于FTP的文件上传和下载
- 关于qq邮箱 "该文件已达到200次的下载限制,您已不能下载该文件" 的问题处理
- 【转载】关于:读写xls文件,提供下载的一个小例子(jxl 的简单运用) - 创建文件
- 关于下载文件是文件名的空格显示不出来和乱码问题 转
- 关于asp.net文件下载基本操作
- 关于防止文件下载盗链之用js来防止文件地址盗链
- 关于java文件下载文件名乱码问题解决方案
- 关于:读写xls文件,提供下载的一个小例子(jxl 的简单运用)
- 关于java Io流的操作,复制(多个文件)、删除、剪切、下载网络资源