img.asp

来自「ASPSQL企业网络管理系统」· ASP 代码 · 共 48 行

ASP
48
字号
<% 
Function SetForDisplay(field, contentType)
	contentType = contentType
	nFieldSize = field.ActualSize
	bytes = field.GetChunk(nFieldSize)
	Session("Bytes") = bytes
	Session("Type") = contentType
End Function
function GetGontentType(strCT)
	select case UCase(strCT)
		case "GIF"
			GetGontentType = "image/gif"
		case "JPG"
			GetGontentType = "image/jpeg"
		case "BMP"
			GetGontentType = "image/bmp"
		case "ZIP"
			GetGontentType = "application/x-zip-compressed"
		case "DOC"
			GetGontentType = "application/msword"
		case "TXT"
			GetGontentType = "text/plain"
		case "HTM"
			GetGontentType = "text/html"
		case else
			GetGontentType = "application/octet-stream"
	end select
end function
'if recordset is open close it, &H00000001 = AdStateOpen
if session("rs").state = &H00000001 then
	session("rs").close
end if
session("rs").Open session("sqlString"), session("conn")
if session("rs").eof or session("rs")("pic").ActualSize = 0 then
	Response.End()
end if
SetForDisplay session("rs")("pic"), session("rs")("pic_type")

response.Expires = 0
response.Buffer  = True
response.Clear
response.contentType = Session("Type")
response.BinaryWrite Session("Bytes")
Session("Type") = ""
Session("Bytes") = ""
response.End
session("rs").close
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?