::::::::::如何将存在数据库中的二进制文件,按照指定的文件类型读出来:::::::::::

sq0421 2003-10-18 11:44:57
我通过上传图片文件到数据库的方法,可以把其他类型的文件也存到数据库image字段中,但采用原来的读图片的方法来读这样的数据

Response.ContentType = "image/*"
Response.BinaryWrite rs("file_content")

也能读,但文件类型就不对了,保存到硬盘上的文件扩展名为.asp
如何解决?????????????
...全文
46 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
DeltaCat 2003-11-18
  • 打赏
  • 举报
回复
http://hongwen.Y365.com/sjCatstudio.rar
nchen123 2003-11-18
  • 打赏
  • 举报
回复
Response.ContentType = ContentType
nchen123 2003-11-18
  • 打赏
  • 举报
回复
Select Case lcase(Right(fName, 4))
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/html"
Case ".txt"
ContentType = "text/plain"
Case Else
ContentType = "application/octet-stream"
End Select
风轻狂 2003-11-18
  • 打赏
  • 举报
回复
Response.ContentType = "image/gif"

Response.ContentType = "image/jpeg"
风轻狂 2003-11-18
  • 打赏
  • 举报
回复
我也想知道
sq0421 2003-10-20
  • 打赏
  • 举报
回复
up again...
sq0421 2003-10-20
  • 打赏
  • 举报
回复
没人理我...up一下
sq0421 2003-10-18
  • 打赏
  • 举报
回复
关键是在页面上怎么写,链接到该页比如:11.asp,那么他就会提示你保存,保存的文件名称就默认为11.asp
ipman 2003-10-18
  • 打赏
  • 举报
回复
数据库添加一个类型字段不就可以了吗

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧