netice 2006-5-30 19:08
谁有个图片上传的实例?最好是数据库存路径的不是储存2进制文件的
谁有个图片上传的实例?最好是数据库存路径的不是储存2进制文件的
。发个实例代码。我现在用的access数据库。。。谢谢了!
[[i] 本帖最后由 netice 于 2006-5-30 19:09 编辑 [/i]]
Nothing 2006-5-31 09:35
<%
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
function ImageUp(formsize,formdata)
bncrlf=chrb(13) & chrb(10)
divider=leftb(formdata,instrb(formdata,bncrlf)-1)
datastart=instrb(formdata,bncrlf&bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
imageup=midb(formdata,datastart,dataend)
end function
Image=ImageUp (FormSize,Formdata)
set rs=server.CreateObject("adodb.recordset")
strconn="driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("test.mdb")
sql="SELECT * FROM imgtable"
rs.Open sql,strconn,1,3
rs.AddNew
rs("img").appendchunk Image
rs.Update
rs.Close
response.contenttype="image/gif"
response.binarywrite imageup(formsize,formdata)
%>