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
%
>
查看全文
相关阅读:
C# 协变 逆变
go slice 理解
为什么避免使用Task.Wait或者Task.Result
IL笔记
docker随笔
领域事件
总结笔记
基于ASP.NET Core 3.x的端点路由(Endpoint Routing)实现控制器(Controller)和操作(Action)分离的接口服务
CentOS7 多IP搭建SOCKS5代理服务器
Springboot 实现数据库备份还原
原文地址:https://www.cnblogs.com/zzh/p/320470.html
最新文章
Vue管理系统前端系列三登录页和首页及`vuex`管理登录状态
Vue管理系统前端系列二相关工具引入及封装
Vue管理系统前端系列一vue-cli4.x 初始化项目
Vue Axios 的封装使用
uniapp简单的登录页面布局
蚁群算法解决TSP旅行商问题 C# (转)
Rust学习笔记1
第一章 Centos7 学习第一步安装Docker
第四章 学习安装Docker 下的Jenkins
第三章 学习安装Docker 下的Nginx
热门文章
第二章 学习安装Docker web (Portainer)
[转]详细解读微服务的两种模式
[转]ERP总结系列(BOM浅谈)
MariaDB Galera Cluster集群故障恢复
CentOS已死,有事烧纸
使用ScheduledExecutorService执行定时任务时一定要注意各种异常捕获
在CentOS7上安装 MariaDB Galera Cluster 多主集群
IIS 部署 docsify
使用静态的AutofacIOC容器实例来注入服务的一些问题
async await随笔
Copyright © 2011-2022 走看看