* ******************* One. ASP page form enctype settings.
<Form name = "form1" method = "Post" Action = "One. asp" enctype = "multipart/form-Data"> </form>
* ******************* Tow. ASP page to obtain Binary Image Information and upload it to the database.
<% Posteddata = request. binaryread (request. totalbytes)
CRLF = chrb (13) & chrb (10)
Tmpdata = leftb (posteddata, clng (partition B (posteddata, CRLF)-1)
Datastart = paib (posteddata, CRLF & CRLF) + 4
Dataend = instrb (datastart + 1, posteddata, tmpdata)-datastart
Stardata = midb (posteddata, datastart, dataend)
Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From picture"
Rs. Open SQL, CN, 3, 3
Rs. addnew
RS ("p_picture"). AppendChunk stardata
Rs. Update
Rs. Close
Set rs = nothing %>
* ******************* Three. ASP page reads image information from the database and displays it.
<%
Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From picture where p_pictureid =" & request ("ID ")
Rs. Open SQL, CN, 1, 1
%>
<% Response. contenttype = "image/GIF" %>
<% Response. binarywrite RS ("p_picture") %>
<% Rs. Close
Set rs = nothing
CN. Close
Set Cn = nothing
%>