The binary code into the database into the database and display on the web page (newfill)

xiaoxiao2021-03-06  75

Conn.asp ----------- Database connection file index.asp ----------- upload form and display the data that has been uploaded Showing.asp ------- Display Database image data UPLOAD.ASP --------- Save the data of the image, inch into the database DEL.ASP -------------- Delete the picture

Data.mdb (Picture Table) Field Type ID Auto Number IMG OLE object

Index.asp

<% set = server.createObject ("adodb.recordset" ) SQL = "SELECT *WM PICTURE ORDER BY ID DESC" RS.Open SQL, CONN, 1, 1 Do While Not Rs.eof%> "width =" 280 "border = 0> delete <% rs.movenextLoop %>
<% rs.closset = NothingSet conn = nothing%>

Conn.asp <% set conn = server.createObject ("adodb.connection") connStr = "provider = microsoft.jet.Oledb.4.0; data source =" & Server.mappath ("data.mdb") Conn.open ConnStr% >

Showing.asp <% set = server.createObject ("adoDb.recordset") SQL = "SELECT * from picture where id =" & trim (Request " ID ")) RS.Open SQL, CONN, 1, 1

Response.contentType = "image / *" response.binarywrite RS ("img"). getchunk (7500000) rs.closset = NothingSet conn = Nothing%> UPLOAD.ASP <% response.buffer = true 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") SQL = "Select * from picture where id is null" RS.Open SQL, CONN, 1, 3

rs.addnewrs ( "img") appendchunk mydatars.updaters.closeset rs = nothingset conn = nothingresponse.write "