我在PHP中有这个代码:
header("Content-Type: application/vnd.ms-excel");
header("Content-Type: application/download");
header("Content-Length: ".filesize($path.$filename));
header("Content-disposition: attachment; filename=" . urlencode($filename));
readfile($path.$filename);
第一次,我在asp中使用它:
<%
Response.AddHeader "content-disposition","attachment; filename=download.xls"
%>
我也阻止“hotlink”
答案 0 :(得分:3)
Set ObjStr = Server.CreateObject("ADODB.Stream")
ObjStr.Type = 1 'AdBinary – Binário
ObjStr.Open
ObjStr.LoadFromFile "D:\Folder\edital.pdf"
varBuffer = ObjStr.Read
Response.buffer = true
Response.AddHeader "content-disposition","attachment;"
Response.ContentType = "application/pdf"
Response.CacheControl = "public"
Response.BinaryWrite varBuffer