ASP图片上传到数据库功能

来源:百度知道 编辑:UC知道 时间:2024/06/17 00:36:25
我学写了一段图片上传到数据库的代码,可不成功,提示说:rst("img").AppendChunk mydata这条语句是错的,请高手指点,谢谢!
过程好下:
一、设计数据库:wrsjq.mdb
表明为imgurl,其中两个字段:id(自动编号、关键字)、img(OLE 对象)
二、上传图片页面:sctpym.asp
<form action="cltpscym.asp"=test" method="post" enctype="multipart/form-data" name="form1" id="form1">
<label>
<input type="file" name="imgurl">
<input type="submit" name="Submit" value="提交"/>
</label>
</form>
三、处理图片上传页面:cltpscym.asp
<!-- #include file="ljsjk.inc.asp" -->
<%
response.ContentType="image/gif"'设置输出类型为图像
data=request.BinaryRead(request.TotalBytes)'获取客户端传送的所有数据
tcrlf=chrb(13) & chrb(10)'回车符号代码
flag=leftb(data,instrb(data,tcrlf)-1)'获取图像数据结束标志
datastart=instrb(data,tcrlf & tcrlf)+4'获取图像数据开始位置
datalength=instrb(datastart

<%
Response.Buffer = True
Server.ScriptTimeOut=9999999
On Error Resume Next
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta content="all" name="robots" />
<meta name="author" content="木目,Woodeye" />
<meta name="description" content="木目ASP文件上传工具" />
<meta name="keywords" con