上传图片出现ADODB.Stream 错误 '800a0bbc'
这是我asp文件的代码,在本机测试好用,放到服务器上就出现ADODB.Stream 错误 '800a0bbc'错误提示,我有服务器远程桌面,请问怎么改?这是远程服务器IIS的配置截图
这是我上传图片asp文件的源码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../index.asp"
MM_grantAccess=false
If Session("adminMM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="../Connections/xw.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_xw_STRING
MM_editCmd.CommandText = "INSERT INTO picture (mc, dz, tjry, tjsj) VALUES (?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("mc")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("dz")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("tjry")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(Request.Form("tjsj"), Request.Form("tjsj"), null)) ' adDBTimeStamp
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "xc.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!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" />
<title></title>
<link rel="stylesheet" href="../cssbook.css" type="text/css"></link>
</head>
<!--<!-- #include file="cd.asp" -->
<body>
<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
<table width="900" align="center">
<tr valign="baseline">
<td width="186" align="right" nowrap="nowrap">图片名称</td>
<td width="702"><input type="text" name="mc" value="" size="50" /> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">图片地址</td>
<td><input type="text" name="dz" value="picture/" size="40"> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td> <iframe marginwidth=0 framespacing=0 marginheight=0 scrolling=no frameborder=0 width='350' height=20 srcolling=no src="uploadpic.asp"></iframe></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">添加人员</td>
<td><input type="text" name="tjry" value="" size="30" /> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">添加时间</td>
<td><input type="text" name="tjsj" value="<%=date%>" size="20" /> </td>
</tr>
<tr valign="baseline">
<td colspan="2" align="center" nowrap="nowrap"><input type="submit" value="添加图片" /> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
<!--<!-- #include file="end.asp" -->
</body>
</html>
[解决办法]
参考:
调用adodb.stream的savetofile方法时发生错误, ADODB.Stream 错误 800a0bbc 写入文件失败。
原因可能是:
1、你要保存的文件名已存在,而未设置savetofile方法的覆盖属性。
2、路径没有用server.MapPath()映射,这种情况下:
如果路径为绝对路径,则发生上面的问题:写入文件失败。
如果路径为相对路径,则会保存到相对于:c:\\windows\\system32的路径。(本机测试结果)。
3、和错误 '80070070' 一样,空间不足, 引起这个800a0bbc错误。
4、服务器目录不支持写入,或者需要写入的目录不存在 。
在使用化境的上传组件,若网站在服务器的根目录,通常是不会遇到此类问题的,遇到此问题往往是网站是以二级目录方式存放在服务器IIS内,化境的上传路径默认是根目录,因此必须修改化境的上传保存文件的路径,也就是提示出错的ASP网页ManageAddSave.asp→我的出错网页名),而不是提示 “dr.SaveToFile FullPath,2”写入出错所在的文件(UpFile.inc.inc→我的化境无组件上传文件名),将提示出错的网页打开,修改上传文件保存路径 “formPath="/UploadFile/NewsFile"'得到上传目录”,如:你的网站存放的二级目录为‘web2’,路径则改为: “formPath="/web2/UploadFile/NewsFile"'得到上传目录”,至此,问题解决上传成功!
5、老问题有出现,这次的原因是上传的过程中,server.mappath 中上传目录前不能加“/”,原来是 “/upload/11111”改为 "upload/1111"
6、2009年6月12日调试ll上机考试,又出现这个错误,总结原因是上传目录formpath为“test/upload/”,因为本次虚拟目录设置为test路径,所以相应修改:
upfile.asp
1) formpath=“test/upload/”,--> formpath=upload/"
2) if fso.FolderExists("e:/jiaoling-zuoye/javatest/test/upload/"&session("CurUserId"))=false then
fso.CreateFolder("e:/jiaoling-zuoye/javatest/test//upload/"&session("CurUserId"))
end if
注意虚拟目录对应文件夹的位置修改e:/jiaoling-zuoye/javatest