Microsoft VBScript 运行时错误 错误 '800a0046' 没有权限: 'CreateObject'
作者&投稿:吁郑 (若有异议请与网页底部的电邮联系)
问题描述:
我做呢个上传,怎么老是传不上啊?一直显示 “Microsoft VBScript 运行时错误 错误 '800a0046' 没有权限: 'CreateObject'”这是怎么回事?
<!--#include file="upload_5xsoft" -->
<script language="Javascript">
function minipic( *** ileface)
{
window.opener.document.form.minipic.value= *** ileface;
}
function pic( *** ileface)
{
window.opener.document.form.pic.value= *** ileface;
}
</script>
<%
set upload=new upload_5xSoft
set file=upload.file("file2")
formPath="upload/pic/"
if file.filesize>500 then
fileExt=lcase(right(file.filename,3))
if fileExt="asp" then
Response.Write"文件类型非法"
end if
end if
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
if file.FileSize>0 then
file.SaveAs Server.mappath(FileName)
end if
Response.Write(filename)
response.write "<br>图片上传成功,[<a href='sctpck'>返回继续上传</a>]<br><br>图片是:<a href=Javascript:minipic('"&filename&"');><font color=#ff0000>缩略图</font></a> <a href=Javascript:pic('"&filename&"');><font color=#ff0000>放大图</font></a><br><br>"
%>
解析:
开始->运行->dfg
找到\\\"Microsoft Excel 应用程序\\\"(这个名称取决于你调用的Object是什么),然后右键->Properties->security把三个权限都给everyone即可,其实第一个Launch & activate即可
这是权限的问题.
还有一个简单的方法,就是找到c:\windows目录中的scrrun.dll文件,设置属性中的安全,加入user组,并给予读取和运行、读取即可。
你也可以把网站放到FAT32分区试一下.因为在NTFS分区,有关于权限问题有一些程序莫明其妙就出错了
试试这个无组件上传吧!用得比较多
文件:upload_5xsoft.inc
<!--METADATA TYPE="TypeLib" UUID="{***********-0000-0010-8000-00aa006d2ea4}"-->
<%
dim fo,gPath,gAct,gFileName,gFilePath,g,gRootUrl,gBaseUrl,gPage,gSearch,gEachPage,gFolder,gFilter
dim gPageSize,sTemp,gNoFile
dim sfor(28,2)
gPageSize=100
gRootUrl=Session("webeditbase")
if right(gRootUrl,1)<>"/" then gRootUrl=gRootUrl&"/"
gNoFile=array("asp","aspx") '禁止访问的脚本
set fo=Server.CreateObject("Scripting.FileSystemObject")
sFor(0,0)="txt":sFor(0,1)=1
sFor(1,0)="chm":sFor(1,1)=2
sFor(2,0)="hlp":sFor(2,1)=2
sFor(3,0)="doc":sFor(3,1)=3
sFor(4,0)="pdf":sFor(4,1)=4
sFor(5,0)="gif":sFor(5,1)=6
sFor(6,0)="":sFor(6,1)=6
sFor(7,0)="png":sFor(7,1)=6
sFor(8,0)="bmp":sFor(8,1)=6
sFor(9,0)="asp":sFor(9,1)=7
sFor(10,0)="jsp":sFor(10,1)=7
sFor(11,0)="js" :sFor(11,1)=7
sFor(12,0)="":sFor(12,1)=8
sFor(13,0)="":sFor(13,1)=8
sFor(14,0)="s":sFor(14,1)=8
sFor(15,0)="zip":sFor(15,1)=9
sFor(16,0)="rar":sFor(16,1)=9
sFor(17,0)="exe":sFor(17,1)=10
sFor(18,0)="avi":sFor(18,1)=11
sFor(19,0)="mpg":sFor(19,1)=11
sFor(20,0)="ra" :sFor(20,1)=12
sFor(21,0)="ram":sFor(21,1)=12
sFor(22,0)="mid":sFor(22,1)=13
sFor(23,0)="wav":sFor(23,1)=13
sFor(24,0)="mp3":sFor(24,1)=13
sFor(25,0)="asf":sFor(25,1)=11
sFor(26,0)="php":sFor(26,1)=7
sFor(27,0)="php3":sFor(27,1)=7
sFor(28,0)="aspx":sFor(28,1)=7
gFilePath=Request.ServerVariables("SCRIPT_NAME")
gFileName=mid(gFilePath,instrRev(gFilePath,"/")+1)
gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
gPath=lcase(getVar("path","str",gRootUrl))
if left(gPath,1)<>"/" then gPath=gRootUrl&gPath
gPage=getVar("page","num",1)
gAct=getVar("act","str","")
gFilter=getVar("filter","str","")
setBaseUrl
sub setBaseUrl()
gBaseUrl=gFileName&"?page="&gPage&"&path="&gPath
if gFilter<>"" then gBaseUrl=gBaseUrl&"&filter="&gFilter
end sub
function getVar(theStr,strType,defValue)
select case strType
case "str"
if isEmpty(Request.QueryString(theStr)) or trim(Request.QueryString(theStr))="" then
getVar=defValue
else
getVar=trim(Request.QueryString(theStr))
end if
case "num"
if isEmpty(Request.QueryString(theStr)) or not isNumeric(Request.QueryString(theStr)) then
getVar=defValue
else
getVar=cint(Request.QueryString(theStr))
end if
case else
getStr=defValue
end select
end function
function getForm(theStr,strType,defValue)
select case strType
case "str"
if isEmpty(Request.form(theStr)) or trim(Request.form(theStr))="" then
getForm=defValue
else
getForm=trim(Request.form(theStr))
end if
case "num"
if isEmpty(Request.form(theStr)) or not isNumeric(Request.form(theStr)) then
getForm=defValue
else
getForm=cint(Request.form(theStr))
end if
case else
getForm=defValue
end select
end function
sub End(info,i *** ack,dir)
set fo=nothing
set gFolder=nothing
if info<>"" then Response.Write("<script language=""javascript"">alert('"&info&"');</script>")
select case i *** ack
case 1
Response.Write("<script language=""javascript"">history.back();</script>")
case 2
Response.Write("<script language=""javascript"">location.href='"&dir&"';</script>")
end select
Response.write("</body></>")
Response.End
end sub
function procIsEdit(sName)
dim i1,i,isEdit
isEdit=Array(1,7,8)
procIsEdit=0
i1=procGetFormat(sName)
for i=0 to ubound(isEdit)
if isEdit(i)=i1 then
procIsEdit=1
exit for
end if
next
end function
function procGetExtName(sName)
procGetExtName=""
if instrRev(sName,".")<1 then exit function
procGetExtName=lcase(mid(sName,instrRev(sName,".")+1))
end function
function procGetFormat(sName)
dim i,str
procGetFormat=0
if instrRev(sName,".")=0 then exit function
str=lcase(mid(sName,instrRev(sName,".")+1))
for i=0 to uBound(sFor,1)
if str=sFor(i,0) then
procGetFormat=sFor(i,1)
exit for
end if
next
end function
function procCheckFile(sName,ischeck)
dim sExt,sPath,i,errorchar
errorchar=array("'","""","\","/","*","?","&","|","<",">")
procCheckFile="ok"
sExt=lcase(procGetExtName(sName))
if gFilter<>"" then
if instr(sName,gFilter)<1 then
procCheckFile="没有权限访问此文件!"
exit function
end if
end if
if Session("webeditrun")="0" then
for i=0 to ubound(gNoFile)
if gNoFile(i)=sExt then
procCheckFile="没有权限访问此文件!"
exit function
end if
next
end if
if ischeck>0 then
sPath=left(sName,instrRev(sName,"/"))
sPath=procCheckDir(sPath,1)
if sPath<>"ok" then
procCheckFile=sPath
exit function
end if
if ischeck=1 and not fo.FileExists(Server.MapPath(sName)) then
procCheckFile="文件没有找到!"
exit function
end if
else
for i=0 to ubound(errorchar)
if instr(sName,errorchar(i))>0 then
procCheckFile="文件名中含有非法字符!"
exit function
end if
next
end if
procCheckFile="ok"
end function
function procCheckDir(sPath,mode)
dim errorchar,i,hd,str
sPath=lcase(sPath)
procCheckDir="ok"
errorchar=array("'","""","\","..","","*","?","&","|","<",">")
if isempty(sPath) or trim(sPath)="" then
procCheckDir="目录不能为空!"
exit function
end if
for i=0 to ubound(errorchar)
if instr(sPath,errorchar(i))>0 then
procCheckDir="目录名中含有非法字符"
exit function
end if
next
if gFilePath=left(sPath,len(gFilePath)) then
procCheckDir="没有权限访问此目录!"
exit function
end if
if mode=0 then exit function
if not fo.FolderExists(Server.MapPath(sPath)) then
procCheckDir="目录"&sPath&"没有找到!"
exit function
end if
if left(sPath,len(gRootUrl))<>gRootUrl then
procCheckDir="没有权限访问此目录!"
exit Function
end if
end function
'取文件夹的类型
Function GetFileExt(strFilePath)
GetFileExt=Mid(strFilePath,InstrRev(strFilePath,"."))
End Function
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
'''''''''''''''''''''''''''''''''''''''''''''''''
'
'请保留此信息: 稻香老农制作5xSoft/ ;
'
'''''''''''''''''''''''''''''''''''''''''''''''''
dim upfile_5xSoft_Stream
Class upload_5xSoft
dim Form,File,Version
Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
Version="数据添加成功!!"
if Request.TotalBytes<1 then Exit Sub
set Form=CreateObject("Scripting.Dictionary")
set File=CreateObject("Scripting.Dictionary")
set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")
upfile_5xSoft_Stream.mode=3
upfile_5xSoft_Stream.type=1
upfile_5xSoft_Stream.open
upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)
vbEnter=Chr(13)&Chr(10)
iDivLen=inString(1,vbEnter)+1
strDiv=subString(1,iDivLen)
iFormStart=iDivLen
iFormEnd=inString(iformStart,strDiv)-1
while iFormStart < iFormEnd
iStart=inString(iFormStart,"name=""")
iEnd=inString(iStart+6,"""")
mFormName=subString(iStart+6,iEnd-iStart-6)
iFileNameStart=inString(iEnd+1,"filename=""")
if iFileNameStart>0 and iFileNameStart<iFormEnd then
iFileNameEnd=inString(iFileNameStart+10,"""")
mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)
iStart=inString(iFileNameEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFileSize=iEnd-iStart-4
else
mFileSize=0
end if
set theFile=new FileInfo
theFile.FileName=getFileName(mFileName)
theFile.FilePath=getFilePath(mFileName)
theFile.FileSize=mFileSize
theFile.FileStart=iStart+4
theFile.FormName=FormName
file.add mFormName,theFile
else
iStart=inString(iEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFormValue=subString(iStart+4,iEnd-iStart-4)
else
mFormValue=""
end if
form.Add mFormName,mFormValue
end if
iFormStart=iformEnd+iDivLen
iFormEnd=inString(iformStart,strDiv)-1
wend
End Sub
Private Function subString(theStart,theLen)
dim i,c,stemp
upfile_5xSoft_Stream.Position=theStart-1
stemp=""
for i=1 to theLen
if upfile_5xSoft_Stream.EOS then Exit for
c=ascB(upfile_5xSoft_Stream.Read(1))
If c > 127 Then
if upfile_5xSoft_Stream.EOS then Exit for
stemp=stemp&Chr(AscW(ChrB(AscB(upfile_5xSoft_Stream.Read(1)))&ChrB(c)))
i=i+1
else
stemp=stemp&Chr(c)
End If
Next
subString=stemp
End function
Private Function inString(theStart,varStr)
dim i,j,bt,theLen,str
InString=0
Str=toByte(varStr)
theLen=LenB(Str)
for i=theStart to upfile_5xSoft_Stream.Size-theLen
if i>upfile_5xSoft_Stream.size then exit Function
upfile_5xSoft_Stream.Position=i-1
if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then
InString=i
for j=2 to theLen
if upfile_5xSoft_Stream.EOS then
inString=0
Exit for
end if
if AscB(upfile_5xSoft_Stream.Read(1))<>AscB(MidB(Str,j,1)) then
InString=0
Exit For
end if
next
if InString<>0 then Exit Function
end if
next
End Function
Private Sub Class_Terminate
form.RemoveAll
file.RemoveAll
set form=nothing
set file=nothing
upfile_5xSoft_Stream.close
set upfile_5xSoft_Stream=nothing
End Sub
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
Else
GetFilePath = ""
End If
End function
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
Else
GetFileName = ""
End If
End function
Private function toByte(Str)
dim i,iCode,c,iLow,iHigh
toByte=""
For i=1 To Len(Str)
c=mid(Str,i,1)
iCode =Asc(c)
If iCode<0 Then iCode = iCode + 65535
If iCode>255 Then
iLow = Left(Hex(Asc(c)),2)
iHigh =Right(Hex(Asc(c)),2)
toByte = toByte & chrB("&H"&iLow) & chrB("&H"&iHigh)
Else
toByte = toByte & chrB(AscB(c))
End If
Next
End function
End Class
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
End Sub
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=1
if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function
if FileStart=0 or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
upfile_5xSoft_Stream.position=FileStart-1
upfile_5xSoft_Stream.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=0
end function
End Class
</SCRIPT>
上传表单:
<form action="upload" method="post" enctype="multipart/form-data" name=form1>
上传:<input name=file type=file size="30">
<input type=submit>
</form>
文件upload
<!--#include FILE="upload_5xsoft.inc"-->
<%
formPath="c:\upload\"
set upload=new upload_5xSoft
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then
response.write "<br>"&file.FilePath&file.FileName&",大小:"&file.FileSize&" => "&formPath&file.FileName
file.SaveAs Server.mappath(formPath&file.FileName)
end if
next
%>
劳制生血: 系统运行故障.有备份的话就进行一下系统还原就行了.要不就找到这份文件删掉它(此文件在系统安装目录,不保证一定能删掉,删之前最好备份一下C盘文件,怕你删后开不了机).有条件的话就重装一下系统.要不在重装前下载个360系统急救箱,修复一下系统试试!!!!!!!!!!!
新浦区15978215584: WIN7开机出现Microsoft VBScript 编译器错误 - ?
劳制生血: 1、到“我的电脑” -> “工具” -> “文件夹选项” -> “查看”,检查一下是否已经勾选:“在登陆时还原上一个文件夹窗口” 2、当然,也不排除病毒的可能.如果msonfig里面没有的话,可以这样看看:(自动打开"C:\Windows\System32"...
新浦区15978215584: 电脑开机Microsoft VBScript运行时错误,求解决办法,哪位电脑高手来帮帮忙.! - ?
劳制生血: 开始-运行-msconfig-启动-把里面的勾都去掉,重启ok
新浦区15978215584: 什么是vbs脚本??
劳制生血: VBS 就是 Visual Basic Scripting 脚本, 是脚本语言的一种 Microsoft Visual Basic Scripting Edition 将灵活的脚本应用于更广泛的领域,包括 Microsoft Internet Explorer 中的 Web 客户机脚本和 Microsoft Internet Information Service 中的 Web 服务...
新浦区15978215584: vb script.是什么?
劳制生血: Script 是脚本的意思 就是说有VB 写的脚本 百科的详细解释: VBScript是Visual Basic Script的简称,即 Visual Basic 脚本语言,有时也被缩写为VBS.是asp动态网页默认的编成语言,配合asp内建对象和ADO对象,用户很快就能掌握访问数据...
新浦区15978215584: vbscript引擎是什么??
劳制生血: 什么是 VBScript? 是一种脚本语言,在ASP中使用,当然ASP.NET中也有 Microsoft Visual Basic Scripting Edition 是程序开发语言 Visual Basic 家族的最新成员,它将灵活的 Script 应用于更广泛的领域,包括 Microsoft Internet Explorer 中的 ...
新浦区15978215584: 文件夹打不开,老是出现Microsoft VBScript 编译器错误 - ?
劳制生血: 第一步:扫描恶意插件(如果觉得系统里面没有恶意插件话,可以跳过) 用新版金山网盾【 http://cu003.www.duba.net/duba/tools/dubatools/kws/kwssetup.exe 直接点击或复制到工具里下载】安装后运行-直接点一键修复-扫描后-点立即处理,桌...
新浦区15978215584: Microsoft VBScript 运行时错误 错误 '800a000d' - ?
劳制生血: 在使用vbscript进行asp开发时,一些朋友会碰到以下类似的错误: Microsoft VBscript 运行时错误 '800a000d' 类型不匹配: '*******' /solweb/sdbottm_right.asp, line 80错误原因: 该错误是因为在运行iis服务的windows 2003 server上安装了...
新浦区15978215584: win2003运行asp提示 Microsoft VBScript 运行时错误 - ?
劳制生血: 发生此错误的原因通常是,COM 对象依赖的动态链接库 (DLL) 出现以下情形之一: 1.在系统中找不到2.不在系统路径中3.系统由于安全设置而无法访问 你只需要在服务器上将所依赖的这个dll重新注册一下就行了,注册方法: 1.先把PPMSO组件的dll复制到c:/windows/system32目录下2.在命令行中执行如下脚本:【regsvr32 X.dll】,其中X.dll为该dll的文件名. 如果注册不成功,说明是由于安全设置被系统拒绝,你可以直接给我发消息.希望对你有所帮助!
新浦区15978215584: 我从网站后台上传图片出现“Microsoft VBScript 运行时错误 错误”这是怎么回事,请高手帮忙. - ?
劳制生血: 如果 VBScript 脚本执行系统无法实施的操作,则会产生 VBScript 运行时错误 详见asp中常见的调试错误