时间:2021-02-10 14:49:12 | 栏目:ASP代码 | 点击:次
<% db_path="testimg.mdb" set conn=server.CreateObject("ADODB.connection") connstr="driver={Microsoft Access Driver (*.mdb)};dbq="&server.MapPath(db_path) conn.open connstr %> |
<form action="upload.asp" method="post" enctype="multipart/form-data"> <input type="file" name="imgurl"> <input type="submit" name=ok value="ok"> </form> |
<!--#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" %> |
<!--#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 %> |
<!--#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%> |