function procCheckFile(sName)
dim sExt,sPath,i,errorchar
errorchar=array("'","""","\","/","*","?","&","|","<",">")
procCheckFile="ok"
sPath=left(sName,instrRev(sName,"/"))
sPath=procCheckDir(sPath,1)
if sPath<>"ok" then
procCheckFile=sPath
exit function
end if
if 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 mode=0 then exit function
if not fo.FolderExists(Server.MapPath(sPath)) then
procCheckDir="目录"&sPath&"没有找到!"
exit function
end if