图片上传借误码,请教

kersic 2003-10-16 10:09:37
index.htm
========================================
<% response.buffer=true %>
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head><body>
<form method="POST" action="process.asp">
<p>请输入图片:<input type="file" name="pic" size="20">
<input type="submit" value="提交" name="B1">
<input type="reset" value="全部重写" name="B2"></p>
</form></body>
</html>
=================================================================
Process.asp
<%
response.buffer=true
Imagesize=Request.TotalBytes
ImageData=Request.BinaryRead(ImageSize)
BnCrLf=chrB(13)&chr(10)
Divider=LeftB(ImageData, Clng(InstrB(ImageData,BnCrLf))-1)
response.write(Clng(InstrB(ImageDate,BnCrLf))-1)
Dstart=InstrB(ImageData,BnCrLf&CrLf)+4
Dend=InstrB(Dstart+1,ImageData,Divider)-Dstart
MyData=MidB(ImageDate,Dstart,Dend)
Set imgConn=Server.CreateObject("Adodb.connection")
imgConn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.Mappath("img.mdb")
strConn="select * from img"
set rs=Server.CreateObject("Adodb.RecordSet")
rs.open strConn,imgConn,1,3
Rs.AddNew
rs("pic").AppendChunk MyData
Rs.Update
Rs.close
Imgconn.close
set rs=nothing
set imgconn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
</body>
</html>
错误情况:
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft VBScript 运行时错误 错误 '800a0005'
无效的过程调用或参数: 'LeftB'
/UploadPic/process.asp,行6
...全文
23 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
kersic 2003-10-25
  • 打赏
  • 举报
回复
请输入图片:<input type="file" name=mefile >
通过这个代码便可以找到图片.
隐者神归 2003-10-23
  • 打赏
  • 举报
回复
BnCrLf=chrB(13)&chr(10)
该:
BnCrLf=chrB(13)&chrB(10)
jingxiaoping 2003-10-23
  • 打赏
  • 举报
回复
你在显示图片时没有固定的ID与之匹配,即不清楚显示的是哪张图片?
再一个就是建议你在显示图片的时候先考虑图片是否存在,如果不存在的话用另外的图片来代替
kersic 2003-10-17
  • 打赏
  • 举报
回复
对了.数据库是ACCESS的.
数据库名:img.mdb
表名:img
id 主键/自动增加
pic OLE对象
kersic 2003-10-17
  • 打赏
  • 举报
回复
加上去了.还不行.我修改了,再传一下.
index.htm
=======================================================================
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head><body>
<form method="POST" action="process.asp" enctype="multipart/form-data">
<p>请输入图片:<input type="file" name=mefile >
<input type="submit" value="提交" name="B1">
<input type="reset" value="全部重写" name="B2"></p>
</form></body></html>

process.asp
=======================================
<%
response.buffer=true
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

<%
Imagesize=Request.TotalBytes
ImageData=Request.BinaryRead(ImageSize)
bncrlf=chrB(13) & chrb(10)

Divider=LeftB(ImageData, Clng(InstrB(ImageData,bncrlf))-1)
Dstart=InstrB(ImageData,bncrlf&bnCrLf)+4
Dend=InstrB(Dstart+1,ImageData,Divider)-Dstart
MyData=MidB(ImageDate,Dstart,Dend)
'mydata=imagedata
Set imgConn=Server.CreateObject("Adodb.connection")
imgConn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.Mappath("img.mdb")
strConn="select * from img"
set rs=Server.CreateObject("Adodb.RecordSet")
rs.open strConn,imgConn,1,3
Rs.AddNew
rs("pic").AppendChunk MyData
Rs.Update
Rs.close
Imgconn.close
set rs=nothing
set imgconn=nothing
%>

show.asp
===============================================
<%
Response.buffer=True
%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head><body>
<%
set imgconn=Server.CreateObject("Adodb.connection")
imgConn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&server.mappath("img.mdb")
set rs=server.CreateObject("Adodb.RecordSet" )
sql="select * from img "
rs.open sql,imgconn
response.contentType="image/*"
response.write rS("pic").GetChunk(7500000)&"<br>"
Rs.close
imgconn.close
set rs=nothing
set imgconn=nothing
%>
</body></html>
show.asp会被下载下来.!
kersic 2003-10-17
  • 打赏
  • 举报
回复
哪位大侠帮帮忙?
好急啊!
dgm8 2003-10-16
  • 打赏
  • 举报
回复
同意楼上的
stefli 2003-10-16
  • 打赏
  • 举报
回复
要加上这个form里面:
enctype="multipart/form-data"
kersic 2003-10-16
  • 打赏
  • 举报
回复
不记得在什么地方COPY过来.但总是出错.

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧