ASP + ACCESS 提交照片到数据信息库与将照片读取数

2021-02-04 04:12 admin

ASP + ACCESS 提交照片到数据信息库与将照片读取数据信息库显示信息之完成(详尽版) 信息内容 互连网 公布 访问: <

form action= upload.asp method= post enctype= multipart/form-data
input type= file name= imgurl
input type= submit name=ok value= ok
/form

四、接纳数据信息并加上纪录页upload.asp

!--#include file= conn.asp --
%
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13) chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
set rs=server.createobject( ADODB.recordset )
rs.open SELECT * FROM imgurl ,conn,3,3
rs.addnew
rs( img ).AppendChunk myData
rs.update
rs.close
set rs=nothing
set conn=nothing
response.redirect index.asp
%

五、获取数据信息库表格中照片字段名內容以做显示信息照片页showimg.asp

!--#include file= conn.asp --
%
set rs=server.createobject( ADODB.recordset )
sql= select * from imgurl where id= trim(request( id ))
rs.open sql,conn,1,1
Response.ContentType= image/*
Response.BinaryWrite rs( img ).getChunk(8000000)
rs.close
set rs=nothing
set conn=nothing
%

六、显示信息照片的index.asp

!--#include file= conn.asp --
%
strsql= select * from imgurl
set rs=server.createobject( ADODB.recordset )
rs.open strsql,conn,1,1
do until rs.eof
whatid=rs( id )
%
img src= showimg.asp?id= %=whatid%

%
rs.movenext
loop

%