新微赢技术网

标题: [求助]上传图片,显示的问题 [打印本页]

作者: ♀〓♂♀〓♂    时间: 2010-1-6 23:38
标题: [求助]上传图片,显示的问题
upload.htm:
<center>
<form name="mainForm" enctype="multipart/form-data" action="process.ASP" method=post>
<input type=file name=mefile>
<input type=submit name=ok value="OK">
</form>
</center>

process.asp:
<body>
<%
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)

dim conn,str
set conn=server.CreateObject("ADODB.connection")
str="driver={microsoft access driver (*.mdb)};dbq=e:\aspstation\database\db3.mdb"
conn.Open str
set rs=server.createobject("ADODB.recordset")
rs.Open "SELECT * FROM images where id is null",conn,1,3
rs.addnew
rs("img").appendchunk mydata
rs.update
rs.close
set rs=nothing
set conn=nothing
%>
</body>

showimg.asp:
<body>
<%
dim conn,str
set conn=server.CreateObject("ADODB.connection")
str="driver={microsoft access driver (*.mdb)};dbq=e:\aspstation\database\db3.mdb"
conn.Open str
dim rs,sql
set rs=server.createobject("ADODB.recordset")
sql="select img from images where id="&trim(request("id"))
rs.open sql,conn,1,1
Response.ContentType = "image/*"
Response.BinaryWrite rs("img").getChunk(7500000)
rs.close
set rs=nothing
set conn=nothing
%>
</body>
上面的代码有错误么?
如何显示我上传的图片?运行showimg.asp可以么?
作者: 汽车小改装    时间: 2010-2-26 18:05
偶学习的对像‖→为你伤心为你哭




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2