六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

ASP完成文件直接下載

[摘要]在IE進(jìn)行文檔鏈接時(shí),如果遇到OLE支持的文檔,IE會(huì)自動(dòng)調(diào)用相應(yīng)程序打開它,有時(shí)候這種功能并不是我們所需的,雖然我們可以提醒用戶用鼠標(biāo)右鍵-->"目標(biāo)另存為...."命令來下載文檔,但這樣畢竟不太友好,本文描述了利用FSO及Stream方法實(shí)現(xiàn)IE直接下載文檔.<...

在IE進(jìn)行文檔鏈接時(shí),如果遇到OLE支持的文檔,IE會(huì)自動(dòng)調(diào)用相應(yīng)程序打開它,有時(shí)候這種功能并不是我們所需的,雖然我們可以提醒用戶用鼠標(biāo)右鍵-->"目標(biāo)另存為...."命令來下載文檔,但這樣畢竟不太友好,本文描述了利用FSO及Stream方法實(shí)現(xiàn)IE直接下載文檔.

<%@ language=vbscript codepage=65001%>

<%
'Filename must be input
if Request("Filename")="" then
 response.write "<h1>Error:</h1>Filename is empty!<p>"
else
call  downloadFile(replace(replace(Request("Filename"),"\",""),"/",""))   
 
Function  downloadFile(strFile)   
'  make  sure  you  are  on  the  latest  MDAC  version  for  this  to  work   
'  get  full  path  of  specified  file   
strFilename  =  server.MapPath(strFile)   
 
'  clear  the  buffer   
Response.Buffer  =  True   
Response.Clear   
 
'  create  stream   
Set  s  =  Server.CreateObject("ADODB.Stream")   
s.Open   
 
'  Set  as  binary   
s.Type  =  1   
 
'  load  in  the  file   
on  error  resume  next   
 
'  check  the  file  exists
Set  fso  =  Server.CreateObject("Scripting.FileSystemObject")   
if  not  fso.FileExists(strFilename)  then   
Response.Write("<h1>Error:</h1>"&strFilename&" does not exists!<p>")   
Response.End   
end  if
 
'  get  length  of  file   
Set  f  =  fso.GetFile(strFilename)   
intFilelength  =  f.size   
 
s.LoadFromFile(strFilename)   
if  err  then   
Response.Write("<h1>Error: </h1>Unknown Error!<p>")   
Response.End
end  if 

'  send  the  headers  to  the  users  Browse
Response.AddHeader  "Content-Disposition","attachment;  filename="&f.name   
Response.AddHeader  "Content-Length",intFilelength   
Response.CharSet  =  "UTF-8"   
Response.ContentType  =  "application/octet-stream"   

'  output  the  file  to  the  browser   
Response.BinaryWrite  s.Read   
Response.Flush   

'  tidy  up   
s.Close   
Set  s  =  Nothing   

End  Function   
end if
%>     




標(biāo)簽:ASP完成文件直接下載 
主站蜘蛛池模板: 婷婷精品在线 | 一级做a爰性视频 | 日本免费网站 | 欧美在线看欧美高清视频免费 | 日韩 欧美 中文 | 色爱区综合 | 日本一区午夜爱爱 | 偷拍精品视频一区二区三区 | 在线观看永久免费视频网站 | 一级毛片在线免费视频 | 天天天天色 | 亚洲伊人成综合人影院小说 | 日韩国产欧美成人一区二区影院 | 人妖在线精品一区二区三区 | 探花视频免费观看高清 | 色天使久久 | 亚洲最色网站 | 亚洲欧美国产精品第1页 | 日日射夜夜操 | 日日操夜夜添 | 天天做天天爱夜夜爽毛片毛片 | 中文字幕激情 | 在线亚州 | 在线观看亚洲一区二区 | 欧美综合中文字幕久久 | 色综合色综合色综合色综合 | 日本欧美色 | 无码免费一区二区三区免费播放 | 欧美在线观看一区二区三区 | 欧美特黄一区二区三区 | 日韩在线观看精品 | 亚洲成a人v欧美综合天堂下载 | 天天干天天操天天拍 | 在线观看黄免费 | 亚洲sss| 西西人体大胆77777视频 | 日本高清视频成人网www | 深夜福利网站在线 | 亚洲精品日韩专区在线观看 | 欧美在线免费观看视频 | 特黄视频 |