各位帮忙看下:这段代码为什么无法将图片文件放不进数据库去,红色代码部分是问题嫌疑所在:另外,我的数据表:'发言表',中用于存放图片的字段名是fimg,类型为image,长度16,允许为空,其他字段均测试正常。 <% on error resume next dim iname, iqq, ihomeurl, imail, icontent,itime,imsg,ierror if request("action") = "new" then response.buffer=true ImageSize=Request.TotalBytes '获取提交数据量的总字节数 ImageData=Request.BinaryRead(ImageSize) '保存从客户端读取到的数据 '优化读取到的二进制数据 BnCrLf=chrB(13)&chr(10) Divider=LeftB(ImageData,Clng(InstrB(ImageData, BnCrLf))-1) Dstart=InstrB(ImageData, BnCrLf& BnCrLf)+4 Dend=InstrB(Dstart+1, ImageData, Divider)- Dstart MyData=MidB(ImageData, Dstart, Dend) iname = inohtml(trim(request("name"))) iszid = inohtml(trim(request("szid"))) iqq = inohtml(trim(request("qq"))) ihomeurl = inohtml(trim(request("homeurl"))) imail = inohtml(trim(request("mail"))) ititle = inohtml(trim(request("title"))) icontent = inohtml(trim(request("content"))) iface = request("face") iip = request.servervariables("Remote_Addr") itime = now() strconn = "select * from '发言表'" set rs = server.createobject("adodb.recordset") rs.open strconn, conn, 1, 3 rs.addnew rs("fname") = iname rs("fszid") = iszid rs("fqq") = iqq rs("fhomeurl") = ihomeurl rs("fmail") = imail rs("ftitle") = ititle rs("fcontent") = icontent rs("ftime") = itime rs("fip") = iip rs("fface") = iface rs("fimg").AppendChunk myData '此句用于上传图片到SQLserver,问题嫌疑点之一 rs.update rs.close set rs = nothing if err.number = 0 then response.redirect ("index.asp") else session("imsg") = "2" response.redirect ("msg.asp")'这里是报错页面,如果报错,是说明上传到数据库不成功,表单输入是没有问题的。 end if end if %>
<table> <form method="post" name="input" action="write.asp?action=new"> <tr> <td>代号:</td> <td><input name="szid" id="szid" size="30" maxlength="12" ></td> </tr> <tr> <td>昵称:</span></td> <td><input name="name" type="text" id="name" size="30" maxlength="12" ></td> </tr> <tr> <td>Q Q:</td> <td><input name="qq" type="text" id="qq" size="30" maxlength="10"></td> <td width="273" rowspan="4"><img id="strface" src="images/humen/1.gif"></td> </tr> <tr> <td>主页:</td> <td><input name="homeurl" type="text" id="homeurl" size="30"></td> </tr> <tr> <td>邮箱:</td> <td><input name="mail" type="text" id="mail" size="30"></td> </tr> <tr> <td>头像:</td> <td><select name="face" onChange="document.images['strface'].src=options[selectedIndex].value;"> <% for i=1 to 108 response.write ("<option value='images/humen/" & i & ".gif'>头像" & i & "</option>") next %> </select></td> </tr> <tr> <td>标题:</td> <td><input name="title" type="text" id="title" maxlength="50" ></td> </tr> <tr> <td>留言:</td> <td><textarea name="content" rows="9" id="Message"></textarea></td> </tr> <tr> <td height="30" colspan="5" width="400" align="left">图片上传:<input type="file" name="img"></td> </tr> <tr> <td><input name="提交" type="submit" id="提交" value="提交发言"></td> </tr> </form> </table>