zoukankan
html css js c++ java
asp二进制输出图片的源代码
'
8*******************************************8
'
需要在你的服务器上安装 MDAC 2.6 或MDAC2.7
'
8*******************************************8
<
%
Dim
strFilePath, strFileSize, strFileName
Const
adTypeBinary
=
1
Response.Buffer
=
True
strFileName
=
"
logo.gif
"
FilePath
=
Server.MapPath(
"
manage/images/
"
&
strFileName)
Response.Clear
Set
objStream
=
Server.CreateObject(
"
ADODB.Stream
"
)
objStream.Open
objStream.Type
=
adTypeBinary
objStream.LoadFromFile FilePath
strFileSize
=
objStream.size
strFileType
=
lcase
(
Right
(strFileName,
4
))
'
文件扩展名
'
通过文件扩展名判断 Content-Types
Select
Case
strFileType
Case
"
.asf
"
ContentType
=
"
video/x-ms-asf
"
Case
"
.avi
"
ContentType
=
"
video/avi
"
Case
"
.doc
"
ContentType
=
"
application/msword
"
Case
"
.zip
"
ContentType
=
"
application/zip
"
Case
"
.xls
"
ContentType
=
"
application/vnd.ms-excel
"
Case
"
.gif
"
ContentType
=
"
image/gif
"
Case
"
.jpg
"
,
"
jpeg
"
ContentType
=
"
image/jpeg
"
Case
"
.wav
"
ContentType
=
"
audio/wav
"
Case
"
.mp3
"
ContentType
=
"
audio/mpeg3
"
Case
"
.mpg
"
,
"
mpeg
"
ContentType
=
"
video/mpeg
"
Case
"
.rtf
"
ContentType
=
"
application/rtf
"
Case
"
.htm
"
,
"
html
"
ContentType
=
"
text/html
"
Case
"
.asp
"
ContentType
=
"
text/asp
"
Case
Else
'
Handle All Other Files
ContentType
=
"
application/octet-stream
"
End
Select
'
Response.AddHeader "Content-Disposition", "attachment; filename= "&strFileName&""
Response.AddHeader
"
Content-Length
"
, strFileSize
Response.Charset
=
"
UTF-8
"
'
客户端浏览器的字符集UTF-8
Response.ContentType
=
ContentType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set
objStream
=
Nothing
%
>
查看全文
相关阅读:
Gridview使用CheckBox全选与单选 Version 2
Repeater控件第前10笔记录高亮显示
下拉式菜单(DropDownList)连动的选择
DataList控件显示图片要的是效果
电容屏、电阻屏基础知识
SIM300实现GPRS上网
qt练习7 定时爆炸小游戏
用 STL vector 来创建二维数组
sim300_at命令.doc
QT练习6 label,button创建,点击按键关闭
原文地址:https://www.cnblogs.com/zzh/p/320470.html
最新文章
四十二、Android完全退出应用程序
开源框架Pushlet入门
六、表查询一
三、oracle 用户管理一
隐藏或显示GridView控件列 Version 2
Visual Studio 2012使用水晶报表Crystal Report
网站是否有播放音乐功能
Highlight(高亮)Gridview控件列
CheckBox或者CheckBoxList控件选择之后变为只读
怎样判断RadioButtonList控件是否有选择
热门文章
判断URL是否存在
改变Repeater控件中按钮颜色
获取控件在运行时于屏幕中的位置
演练GridView控件显示目录图片
CheckBoxList控件选中的选项不能改变
动态产生DIV标签并找到其ID
从DataTable过滤和获取某行记录
使用Lambda Expressions列出某数值范围中的偶数
让网站能播放MP4的格式视频
Gridview控件导出Excel之后图片无法显示
Copyright © 2011-2022 走看看