ASP實(shí)現(xiàn)強(qiáng)制圖片下載函數(shù)
圖片不進(jìn)行處理,圖片默認(rèn)是用瀏覽器打開(kāi)顯示,如果希望圖片變?yōu)橄螺d可以使用以下代碼
function downloadFile(strFile) 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
以上所述就是本文給大家分享的函數(shù)了,希望對(duì)大家學(xué)習(xí)asp能夠有所幫助。
- ASP 時(shí)間函數(shù)及如何獲取服務(wù)器時(shí)間的寫(xiě)法
- Asp Split函數(shù)之使用多個(gè)分割符的方法
- asp與js的類型轉(zhuǎn)換函數(shù)介紹
- asp中的Rnd 函數(shù)
- ASP轉(zhuǎn)換格林威治時(shí)間函數(shù)DateDiff()應(yīng)用
- ASP移動(dòng)文件函數(shù)movefile權(quán)限不足的替代方法
- ASP中實(shí)現(xiàn)的URLEncode、URLDecode自定義函數(shù)
- asp實(shí)現(xiàn)獲取MSSQL數(shù)據(jù)庫(kù)表指定條件行數(shù)的函數(shù)
- asp中實(shí)現(xiàn)清除html的函數(shù)
- asp實(shí)現(xiàn)截取字符串函數(shù)
- ASP函數(shù)大全解析
相關(guān)文章
asp中去除內(nèi)容HTML標(biāo)簽的三個(gè)function函數(shù)
asp中去除內(nèi)容HTML標(biāo)簽的三個(gè)function函數(shù)...2007-03-03ASP中字符與數(shù)字內(nèi)置操作函數(shù)整理
在ASP中,預(yù)定義了許多函數(shù),可以幫助我們簡(jiǎn)化代碼、提高開(kāi)發(fā)效率,本文將介紹一些常用的ASP字符與數(shù)字內(nèi)置操作函數(shù),以便開(kāi)發(fā)人員更加方便、快速地創(chuàng)建 Web 應(yīng)用程序,2023-12-12P3P 和 跨域 (cross-domain) cookie 訪問(wèn)(讀取和設(shè)置)
在IE 里面跨域去設(shè)置 cookie跨域的實(shí)現(xiàn),嘗試了n中方法都不行,查了一下資料,可以通過(guò)設(shè)置header中的p3p值來(lái)實(shí)現(xiàn),真不錯(cuò):)2009-06-06asp下根據(jù)標(biāo)題生成關(guān)鍵字的代碼
實(shí)現(xiàn)的功能是:標(biāo)題+標(biāo)題里除去非中文及中文標(biāo)點(diǎn)外的字符的、相鄰兩個(gè)字符的集合 傳說(shuō)中這是采集文章處理keywords的最佳方式,呵呵,做了一個(gè),用下試試2008-06-06asp中response.write(''中文'')或者js中文亂碼問(wèn)題
這篇文章主要介紹了asp中response.write('中文')或者js中文亂碼問(wèn)題,有時(shí)候我們需要輸出js也會(huì)出現(xiàn)亂碼,這里給出了幾個(gè)解決方法,需要的朋友可以參考下2020-03-03