求助
upfile.asp<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="">
<tr>
<td>上传文件的个数
<input name="num" type="text" id="num" value="1" size="2">
<input type="submit" name="Submit" value="提交"> </td>
</tr>
</form>
</table>
<%if request("num")= "" then
num = 1
else
num = cint(request("num"))
end if%>
<table width="600" align="center">
<form action="savedb.asp" method="post" name="myform">
<% for i = 1 to num %>
<tr>
<td><input name="file<%=i%>" type="file" id="file">
说明:
<input name="title<%=i%>" type="text" id="file"></td>
</tr>
<%
next
%>
<tr>
<td><input type="submit" name="Submit2" value="上传"></td>
</tr>
<tr>
<td> </td>
</tr>
</form>
</table>
savedb.asp
<!--#include FILE="upfileclass.asp"-->
<%
dim upfile,formPath,ServerPath,FSPath,formName,oFile,rs,conn
set upfile=new upfile_class ''建立上传对象
upfile.GetData (10240000) '取得上传数据,限制最大上传10M
if upfile.err > 0 then '如果出错
select case upfile.err
case 1
Response.Write "你没有上传数据呀???是不是搞错了??"
case 2
Response.Write "你上传的文件超出我们的限制,最大10M"
end select
else
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data.mdb")
set rs=Server.CreateObject("adodb.recordset")
rs.Open "select * from img",conn,1,3
i = 1
for each fName in upfile.file '列出所有上传了的文件
set oFile=upfile.file(fName)
randomize
ranNum=int(90000*rnd)+10000
rs.AddNew
rs("filetitle") = upfile.form("title"&i&"") '取得表单中其他的相关数据
rs("filename")=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&oFileExt ' 文件名
rs("filepath")=oFile.FilePath&oFile.FileName '文件的路径
rs("filetype")=oFile.FileType '文件的类型
rs("fileexp")=oFile.FileExt '文件的扩展名
rs("filedata")=oFile.FileData '文件二进制数权
rs("filesize")=oFile.FileSize '文件容量大小
rs.Update
i = i +1
NEXT
rs.close
set rs = nothing
end if
set upfile = nothing
%>
错误类型:
Microsoft VBScript 运行时错误 (0x800A0005)
无效的过程调用或参数: 'MidB'
/upfileclass.asp, 第 68 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
网页:
POST 64 ??? /savedb.asp
POST Data:
Microsoft VBScript 运行时错误 错误 '800a000d'
类型不匹配: 'Server.HTMLEncode'
/iisHelp/common/500-100.asp,行 221