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
%
>
查看全文
相关阅读:
Windows7,Ubuntu双系统,用MBR引导
把Adblock Plus的过滤规则应用到IE9
Linux shell学习
vxworks下面网络连接调试的搭建
uboot网卡成功识别
uboot功能扩展篇
uboot终于显示串口信息了
uboot解决flash failed无限挂起的问题
问题解决随笔
琐事皆休,开始找工作~
原文地址:https://www.cnblogs.com/zzh/p/320470.html
最新文章
IO的阻塞与非阻塞、同步与异步以及Java网络IO交互方式
工厂方法模式
IIS隐藏响应头信息
软件包离线下载方式
RocketMQ安装
记录一些有意思的
Gitlab安装
lsof实践
获取时间差xx小时xx分钟前
判断SD卡的剩余容量
热门文章
判断网络是否连接
调用系统拍照
EditText自动获取焦点并弹出输入法
android:shape的使用 实心,渐变,描边,圆角
Hadoop安装配置
使用Ubuntu live CD安装Grub
Eclipse自动补全增强
Ubuntu PS1高亮
使用Everything搜索时忽略大小写
使用Recovery+adb工具 解救换字体后忘记修改权限导致的无限重启
Copyright © 2011-2022 走看看