We do one upload. The field of the data library is automatically numbered BIG field type is ole. Oleh is a simple field.
UPPIC.ASP upload program name
<%
DIM RS
Dim Formsize, Formdata, Bncrlf, Divider, DataStart, DataEnd, MyData
Formsize = request.totalBytes' Get the size of the client
Formdata = Request.binaryRead (Formsize) 'Transferring the data from the customer into binary production
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) 'above is a binary data acquired.
%>
<%
SQL = "SELECT * from Pic ORDER BY ID DESC"
SET RS = Server.createObject ("AdoDb.Recordset")
RS.Open SQL, CONN, 3, 2
rs.addnew
RS ("BIG"). Appendchunk mydata 'is added to the database
Rs.Update
SET RS = Nothing
Set conn = Nothing
%>
Next is displayed picture
Display.asp
'This is all, he is a program with the database.
<%
ID = Request ("id")
SET RS = Server.createObject ("AdoDb.Recordset")
SQL = "SELECT * FROM PIC Where id =" & id
RS.Open SQL, CONN, 1, 1
Response.ContentType = "text / html" 'Displays the format of the image can also be used
'Response.contenttype = "image / gif" is displayed in GIF
'Response.contentType = "image / jpg" is displayed in JPG
Response.binaryWrite RS ("BIG") 'Show images
Rs.close
SET RS = Nothing
SET CONNGRAPH = Nothing
%>