Wishlist 0 ¥0.00

ADODB.Stream 错误 '800a0bbc' 写入文件失败

最近在调试一个过去的项目,asp写的一个无组上传类,以前都测试通过的,本次发布却提示:

ADODB.Stream 错误 '800a0bbc'

写入文件失败。

/UpLoadClass_Dreacom_v3/UpLoadClass.asp,行 703

发生此错误的系统是:Windows Server 2008 R2

有的还可能提示:ADODB.Stream 错误 30004

开始以为是权限的问题,于是设置文件夹的权限,甚至给了Everyone完全控制的权限,结果还是不行;

相关错误代码行:

stream.SaveToFile fileName, 2

输出文件路径:

response.write "<br />fileName=" & fileName

指定的保存目录:
folderPath=C:\inetpub\wwwroot\UpLoadClass_Dreacom_v3\Demo1\UpLoadFile

临时文件保存位置:
fileName=C:\inetpub\wwwroot\UpLoadClass_Dreacom_v3\Demo1\UpLoadFile\2015\10\2851107108ad_0.tmp
通过路径可以发现,多了几层目录,这是什么呢?

这涉及到下面的函数:

Public Function GetNewUploadID()
    dim dtstr
    dtstr = Replace(cstr(Date()), "-", "") & CStr(CLng(timer()*1000))
    GetNewUploadID = dtstr & GetRandomCode(20 - Len(dtstr))
End Function

通常我们cstr(Date())得到的数据格式是:2015-10-28,中间的分隔符是减号,而在Windows Server 2008 R2得到的格式是2015/10/28,在执行Server.MapPath时,就把它当成目录来处理了,由于对应的目录不存在,所以导致了这个问题。

找到原因,解决方法就自然明了了,把日期中的“/”也替换掉就可以了。
————————————————
版权声明:本文为CSDN博主「微wx笑」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/testcs_dn/article/details/49467967

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.