Escrever:
1: Leia o arquivo de imagem GIF na memória (uma variável strTemp).
2: Escreva no banco de dados.
dim bintmp () como byte
Dim Conn como Adodb.Connection
Dim RS como Adodb.RecordSet
StrSQL dim Dim como string
Definir conn = new Adodb.Connection
Definir rs = new Adodb.recordset
Conn.open "dB"
strsql = "Selecione * de tbimage"
Rs.pen strsql, Conn, 1, 3
OpenFile ("Bayshore.jpg")
'Por favor, implemente a função OpenFile você mesmo
Rs.Addnew
rs.fields ("imagem"). AppendChunk bintmp
rs.update
Leia e exiba:
show.asp:
<%
dim p
dim l
l = 8192
Dim Conn, RS, StrSQL
Definir Conn = Server.CreateObject ("Adodb.Connection")
Conn.Open "Provider = Microsoft.Jet.oledb.4.0; Data Source =" & Server.mappath (".") & "/db2.mdb;
set rs = server.createObject ("adodb.recordset")
strsql = "Selecione * de tbimage"
Response.ContentType = "Image/Gif"
'importante!
Rs.pen strsql, Conn, 1,1
rs.movelast
fazer
p = rs ("imagem"). getChunk (l)
Response.BinaryWrite p
Se Lenb (P) <l, então saia
laço
%>
Em html:
<imagem src = show.asp>