asp不能显示上传到sql server 2000中图片
我用的是windows 2003操作系统和sql server 2000数据库,相关代码如下上传网页(upload.asp)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body leftmargin="0" topmargin="0">
<form name="upform" method="post" action="test_image.asp" enctype="multipart/form-data" >
<input type="hidden" name="act" value="upload">
<input type="hidden" name="filepath" value="images">
<table width="100%" border="0" cellspacing="0" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr>
<td >
<p style="margin-top: 0; margin-bottom: 0" align="center"> </p>
<p style="margin-top: 0; margin-bottom: 0" align="center">
<font size="5" color="#0000FF">上传界面</font></p>
<p style="margin-top: 0; margin-bottom: 0" align="center">文件上传
<input type="file" name="filename" style="width:229; height:23" class="tx1" value="">
<input type="submit" name="Submit" value="提 交" class="tx">
</p>
<p style="margin-top: 0; margin-bottom: 0" align="center">
</td>
</tr>
</table>
</form>
</body>
</html>
存放图像的网页(test_image.asp)
<!--#include file=conn.asp-->
<%
Dim binSize,binData,binImage
binSize=Request.TotalBytes '表单上传数据的二制进大小
binData=Request.BinaryRead(binSize) '从表单中获取二进制数据
vCrLf=ChrB(13) & ChrB(10)
divider=LeftB(binData,InStrB(binData,vCrLf)-1)
dataStart=InStrB(binData,vCrLf & vCrLf)+4
dataEnd=InStrB(datastart+1,binData,divider)-datastart
binImage=MidB(binData,dataStart,dataEnd) '获取图像部分
Set rs=server.CreateObject("ADODB.Recordset")
strsql="select * from photo where id is null"
rs.Open strsql,conn,1,3
rs.AddNew
rs("images").appendchunk binImage
rs.Update
rs.Close
%>
读取图片网页(photo_image.asp)
<!--#include file=conn.asp-->
<%
Dim binSize,binData,binImage
binSize=Request.TotalBytes '表单上传数据的二制进大小
binData=Request.BinaryRead(binSize) '从表单中获取二进制数据
vCrLf=ChrB(13) & ChrB(10)
divider=LeftB(binData,InStrB(binData,vCrLf)-1)
dataStart=InStrB(binData,vCrLf & vCrLf)+4
dataEnd=InStrB(datastart+1,binData,divider)-datastart
binImage=MidB(binData,dataStart,dataEnd) '获取图像部分
Set rs=server.CreateObject("ADODB.Recordset")
strsql="select * from photo where id is null"
rs.Open strsql,conn,1,3
rs.AddNew
rs("images").appendchunk binImage
rs.Update
rs.Close
%>
显示网页(show_image.asp)
<!--#include file=conn.asp-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="image/*; charset=gb2312">
<title>显示数据库中的图片</title>
</head>
<body>
<%
Dim rs,strsql
Set rs=Server.CreateObject("ADODB.Recordset")
strsql="select * from photo"
rs.Open strsql,conn,1,1
%>
<table width="80%" border="1" align="center">
<%Do While Not rs.EOF %>
<tr>
<td width="100">图片标题</td>
<td><%=rs("id")%></td>
</tr>
<tr>
<td>图片</td>
<td><%response.Write("aaaaaaaaaaaa")%></td>
<td><img src=photo_image.asp?id=<%=rs("id")%>></td>
</tr>
<%rs.movenext
Loop
rs.close
set rs=nothing
%>
</table>
</body>
</html>
可是运行了就是显示不出来图片。请高手指教下!
就是不能显示图片,只有一片空白。
SQL server 2000安装在fat32格式中。请高手指教下,谢谢了!