asp上传图片后在本机测试显示叉子

来源:百度知道 编辑:UC知道 时间:2024/05/15 11:40:11
代码:
image_index.asp
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<%
strsql="select * from pic"
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,conn,1,1
do until rs.eof
%>
</head>
<body>
<tr>
<td width="121"><div align="center"><img src="image_showimg.asp?id=<%=rs("id")%>"
width="100" height="80"> </div></td>
<td width="67"><div align="center"><a href="image_del.asp?id=<%=rs("id")%>">删除
</a></div></td>
</tr>
<%
rs.movenext
loop
rs.close
conn.close
%>
</body>

image_conn.asp
<head>
<meta http

<img src="image_showimg.asp?id=<%=rs("id")%>"
width="100" height="80">
它的连接不对啊!!
应该是<img src="图片存放的文件夹路径!"
width="100" height="80">

鼠标邮件叉号,属性,看图片路径,这样总会了吧

同意1楼,调用的图片路径不对。

可以去文件夹中查看图片地址,然后在代码中修改,就可以了。

把image_showimg.asp里的多余代码删掉, image_showimg.asp输出的应该是图像的编码
<%
db_path="testimage.mdb"
set conn=server.CreateObject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("/database/testimage.mdb")
conn.open connstr
set rs=server.CreateObject("adodb.recordset")
sql="select * from pic where id="&trim(request("id"))
rs.open sql,conn,1,1
response.ContentType=image/*"
response.BinaryWrite rs("img").getchunk(8000000)
rs.close
set rs=nothing
set conn=nothing