ID已过期,来看一下,图片上传问题
我是看你有方法的做了一个如下:newimg.asp关键代码如下:
<form name="mainForm" enctype="multipart/form-data" action="process.asp" method=post>
<input type=file name=mefile><br>
<input type=submit name=ok value="上传">
</form>
process.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 connGraph=server.CreateObject("ADODB.connection")
connGraph.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("user.mdb")
connGraph.Open
set rec=server.createobject("ADODB.recordset")
rec.Open "SELECT * FROM img where id is null",connGraph,1,3
rec.addnew
rec("img").appendchunk mydata
rec.update
rec.close
set rec=nothing
set connGraph=nothing
%>
showimg.asp关键代如下:
<%
set connGraph=server.CreateObject("ADODB.connection")
connGraph.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("user.mdb")
connGraph.Open
set rec=server.createobject("ADODB.recordset")
strsql="select img from img "
rec.open strsql,connGraph,1,1
Response.ContentType = "img/jpeg"
Response.BinaryWrite rec("img").getChunk(7500000)
rec.close
set rec=nothing
set connGraph=nothing
%>
如看不到图给我下面这东东:
?JFIFHH