最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
纯ASP上传图像文件到数据库的最佳例子
时间:2022-06-30 11:17:51 编辑:袖梨 来源:一聚教程网
IAmTrue 发表于2000-11-2 7:56:49 ASP地带
getfile.htm
-------------------------
保存图片到数据库
savetodb.asp
----------------------------------
<%
Response.Buffer = TRUE
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
email = UploadRequest.Item("email").Item("Value")
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,""))
picture = UploadRequest.Item("blob").Item("Value")
'Response.ContentType = contentType
'Response.binaryWrite picture
set objCn = server.createobject("adodb.connection")
set objRst = server.createobject("adodb.recordset")
objCn.Open "upload"
objrst.Open "pic", objcn, 1,3,2
objrst.addnew
objrst.fields("filename")=filename
objrst.fields("type")="gif"
objrst.fields("what").appendchunk picture
objrst.update
response.write "第" & objrst("id") & "个图片。"
getfile.htm
-------------------------
你可以找个图片试试,保存完毕后会有提示
savetodb.asp
----------------------------------
<%
Response.Buffer = TRUE
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
email = UploadRequest.Item("email").Item("Value")
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,""))
picture = UploadRequest.Item("blob").Item("Value")
'Response.ContentType = contentType
'Response.binaryWrite picture
set objCn = server.createobject("adodb.connection")
set objRst = server.createobject("adodb.recordset")
objCn.Open "upload"
objrst.Open "pic", objcn, 1,3,2
objrst.addnew
objrst.fields("filename")=filename
objrst.fields("type")="gif"
objrst.fields("what").appendchunk picture
objrst.update
response.write "第" & objrst("id") & "个图片。"
相关文章
- 蚂蚁森林神奇海洋2026年4月20日答案 05-15
- 胖折叠的终极形态 华为Pura X Max上手评测 05-15
- 2026年4月将从Xbox Game Pass库中移除的所有游戏 05-15
- 《Pragmata》首发销量突破100万份 为全新单机IP注入希望 05-15
- 《Pragmata》两天内销量突破一百万份 05-15
- DNF奇美拉技能链设置推荐 05-15