| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 688 人关注过本帖
标题:求教:高手解答 上传程序报错? ?
只看楼主 加入收藏
skywide81
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-5-30
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
求教:高手解答 上传程序报错? ?
Server 对象 错误 'ASP 0177 : 800401f3'
Server.CreateObject 失败
/admin/uploadfile.asp,行 372
800401f3

370 至376行代码如下 请高手解答 我的qq号是 228695519 感谢

<%
dim SPid,barref,UploadProgress
Set UploadProgress=Server.CreateObject("Persits.UploadProgress")
SPid=UploadProgress.CreateProgressID()
PID="PID=" & SPid
barref="framebar.asp?to=10&" & PID
%>
搜索更多相关主题的帖子: admin 
2011-05-30 15:03
skywide81
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-5-30
收藏
得分:0 
整个文件如下
<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Upload</title>
<style>
<!--
*         {font:12px;}
-->
</style>

</head>
<body leftmargin="1" topmargin="1">
<%
if WS_S.MemberPriv("WS_FrontSetUpload")<>1 then
Response.Write "权限不够,请向管理员申请权限"
Response.end
end if
Dim fileaction,UploadFilePath,UploadLimitSize,NotAllowfileext,BrowerFilePath,folder,savepath,UploadFilePath1,UploadFilePath2,UploadFilePath3,UploadFilePath4,UploadFilePath5,islit,isdel,issize,isrename,savepath1,picwidth,pichight,formname1,formname2,inputname1,inputname2,inputname3,inputname4,filename_1,filename_2
fileaction=Request.QueryString("action")
select case fileaction
case "article"   //上传文章图片
Server.ScriptTimeOut=120
UploadFilePath1 =  "\UploadFile\article\big"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/article/big/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/article/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/article/big/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/article/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\article\small"         //后台略缩图删除绝对路径
islit=0   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=0
isrename=1
formname1="document.all"
inputname1="d_fromurl"
inputname2="spic"
inputname3="url"
picwidth=110   //略缩图宽
pichight=90   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*2   //2M  最大上传文件大小,单位为K
NotAllowfileext = "jpg|jpeg|gif"  //可以上传的文件类型

case "pic"    //上传图片展示
Server.ScriptTimeOut=240
UploadFilePath1 =  "\UploadFile\PicShow\big"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/PicShow/big/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/PicShow/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/PicShow/big/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/PicShow/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\PicShow\small"         //后台略缩图删除绝对路径
islit=1   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=1
isrename=1
formname1="form2"
inputname1="pic"
inputname2="spic"
inputname3="url"
picwidth=110   //略缩图宽
pichight=90   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*10   //10M  最大上传文件大小,单位为K
NotAllowfileext = "jpg|jpeg|gif"  //可以上传的文件类型

case "news"   //上传新闻图片
Server.ScriptTimeOut=120
UploadFilePath1 =  "\UploadFile\news\big"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/news/big/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/news/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/news/big/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/news/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\news\small"         //后台略缩图删除绝对路径
islit=1   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=1
isrename=1
formname1="NewForm"
inputname1="pic"
inputname2="spic"
inputname3="url"
picwidth=236   //略缩图宽
pichight=236   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*5   //5M  最大上传文件大小,单位为K
NotAllowfileext = "jpg|jpeg|gif"  //可以上传的文件类型

case "downpic"   //上传文件图片
Server.ScriptTimeOut=999999
UploadFilePath1 =  "\UploadFile\down\downpic"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/down/downpic/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/down/downpic"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/down/downpic/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/down/downpic/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\down\downpic"         //后台略缩图删除绝对路径
islit=1   //是否自动略缩图
isdel=1   //是否自动略缩图后删除原图
issize=0
isrename=1
formname1="form1"
inputname1="pic"
inputname2="showpic"
inputname3="size"
picwidth=150   //略缩图宽
pichight=120   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*3   //3M  最大上传文件大小,单位为K
NotAllowfileext = "jpg|jpeg|gif"  //可以上传的文件类型

case "downfile"   //上传文件
Server.ScriptTimeOut=999999
UploadFilePath1 =  "\UploadFile\down\downfile"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/down/downfile/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/down/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/down/downfile/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/down/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\down\small"         //后台略缩图删除绝对路径
islit=0   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=1
isrename=0
formname1="form1"
inputname1="url1"
inputname2="spic"
inputname3="size"
picwidth=110   //略缩图宽
pichight=90   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*1000   //1000M  最大上传文件大小,单位为K
NotAllowfileext = "rar|zip|avi|bmp|cab|cdr|chm|doc|dwg|eps|exe|gif|gz|htm|html|ini|ipx|jpeg|jpg|mdb|mid|mov|mp3|mpeg|mpg|pcb|pdf|ppt|psd|pub|qt|ra|ram|sch|tar|tif|tiff|txt|xls"  //可以上传的文件类型

case "movie"   //上传影视
Server.ScriptTimeOut=999999
UploadFilePath1 =  "\UploadFile\movie"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/movie/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/movie/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/movie/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/movie/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\movie\small"         //后台略缩图删除绝对路径
islit=0   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=1
isrename=1
formname1="form2"
inputname1="pic"
inputname2="spic"
inputname3="url"
inputname4="ext"
picwidth=110   //略缩图宽
pichight=90   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 1024*1000   //1000M  最大上传文件大小,单位为K
NotAllowfileext = "asf|avi|flv|wmv|mov|mpg|mpeg|qt|rm|rmvb"  //可以上传的文件类型

case "link"   //上传友情链接图片
Server.ScriptTimeOut=90
UploadFilePath1 =  "\UploadFile\link"         //后台原图保存绝对路径
UploadFilePath =  "../UploadFile/link/"     //后台读取原图路径,以生成略缩图
UploadFilePath2 =  "../UploadFile/link/small"   //后台略缩图保存路径
UploadFilePath3 =  "UploadFile/link/"     //前台原图显示路径
UploadFilePath4 =  "UploadFile/link/small/"     //前台略缩图显示路径
UploadFilePath5 =  "\UploadFile\link\small"         //后台略缩图删除绝对路径
islit=0   //是否自动略缩图
isdel=0   //是否自动略缩图后删除原图
issize=0
isrename=1
formname1="form1"
inputname1="fl_logo"
inputname2="spic"
inputname3="size"
picwidth=110   //略缩图宽
pichight=90   //略缩图高
 savepath=server.MapPath("../")&UploadFilePath1     //文件上传路径
 savepath1=server.MapPath("../")&UploadFilePath5     //略缩图删除路径
BrowerFilePath =  "/"
UploadLimitSize = 30   //30k  最大上传文件大小,单位为K
NotAllowfileext = "jpg|jpeg|gif"  //可以上传的文件类型
end select
if request("act")="upload" then
On Error Resume Next
function CanUpload(Fileurl)
dim NotAllowfileextstr
 Fileurl = lcase("|"& Mid(Fileurl, InstrRev(Fileurl, ".") + 1)& "|")
 NotAllowfileextstr = "|"&NotAllowfileext&"|"
 if instr(NotAllowfileextstr,Fileurl)>0 then
  CanUpload = true
 else
  CanUpload = false
 end if
end function

Function CreateFolder(Filepath)
 Dim fso, f
 on error resume next
 Set fso = CreateObject("Scripting.FileSystemObject")
 if not fso.FolderExists(Filepath) then
  Set f = fso.CreateFolder(Filepath)
  set f = Nothing
 end if
 set fso = Nothing
End Function

Function DeleteFile(filename)
dim fso1
 Set fso1 = CreateObject("Scripting.FileSystemObject")
 if fso1.FileExists(filename) then
  fso1.DeleteFile filename
end if
 set fso1 = Nothing
End Function

Function BuildSmallPic(s_OriginalPath, s_BuildBasePath, n_MaxWidth, n_MaxHeight)
      Err.Clear
      On Error Resume Next
   
      // 检查组件是否已经注册
      Dim AspJpeg
      Set AspJpeg = Server.Createobject("Persits.Jpeg")
      If Err.Number <> 0 Then
          Err.Clear
          BuildSmallPic = "Error_01"
          Exit Function
      End If

      // 检查原图片是否存在
      Dim s_MapOriginalPath
      s_MapOriginalPath = Server.MapPath(s_OriginalPath)
      AspJpeg.Open s_MapOriginalPath   //打开原图片
      If Err.Number <> 0 Then
          Err.Clear
          BuildSmallPic = "Error_02"
          Exit Function
      End If

     // 指定宽度和高度生成
      AspJpeg.Width = n_MaxWidth
      AspJpeg.Height = n_MaxHeight
   
    // 将缩略图存盘开始
      Dim pos, s_OriginalFileName, s_OriginalFileExt   //位置、原文件名、原文件扩展名
      pos = InStrRev(s_OriginalPath, "/") + 1
      s_OriginalFileName = Mid(s_OriginalPath, pos)
      pos = InStrRev(s_OriginalFileName, ".")
      s_OriginalFileExt = Mid(s_OriginalFileName, pos)

      Dim s_MapBuildBasePath, s_MapBuildPath, s_BuildFileName      //缩略图绝对路径、缩略图文件名
      Dim s_EndFlag //小图片文件名结尾标识 例: 如果大图片文件名是“image1.gif”,结尾标识是“_small”,那么小图片文件名就是“image1_small.gif”
      If Right(s_BuildBasePath, 1) <> "/" Then s_BuildBasePath = s_BuildBasePath & "/"
      s_MapBuildBasePath = Server.MapPath(s_BuildBasePath)
      s_EndFlag = "_small"   //可以自定义,只要能区别大小图片即可
      s_BuildFileName = Replace(s_OriginalFileName, s_OriginalFileExt, "") & s_EndFlag & s_OriginalFileExt
      s_MapBuildPath = s_MapBuildBasePath & "\" & s_BuildFileName
   
      AspJpeg.Save s_MapBuildPath   //保存
      If Err.Number <> 0 Then
          Err.Clear
          BuildSmallPic = "Error_03"
          Exit Function
      End If
      //--将缩略图存盘结束--

      //注销实例
      Set AspJpeg = Nothing
      If Err.Number <> 0 Then
          BuildSmallPic = "Error_Other"
          Err.Clear
      End If
'BuildSmallPic = s_BuildBasePath & s_BuildFileName  //返回路径
      BuildSmallPic = s_BuildFileName  //返回文件名  
End Function

 CreateFolder(savepath)
 Set Upload=Server.CreateObject("Persits.Upload")
 Upload.SetMaxSize UploadLimitSize*1024, True
 Upload.OverwriteFiles = false
 if Request.QueryString("PID") = "" then
  Upload.ProgressID="010D60EB00C5AA4B"
 else
  Upload.ProgressID=Request.QueryString("PID")
 end if
 Count=Upload.Save()
 If Err.Number <> 0 Then
  Response.Write "<div style=""color:red;font-size:12px;"">出现错误: " & Err.Number & "、" & Err.Description &"<a href=""javascript:history.go(-1)"">重新上传</a></div>"
 End If
 If Err.Number = 8 Then
  Response.Write "<div style=""color:red;font-size:12px;"">你上传的文件超过限制("& UploadLimitSize/1024 &"M)<a href=""javascript:history.go(-1)"">重新上传</a></div>"
  response.end
 end if
 dim inputname
 dim size,rs_upfile
 For Each File in Upload.Files
  if not CanUpload(File.ext) then
   File.Delete   
   response.write "<div style=""color:red;font-size:12px;"">"&file.filename &"("& file.size &") 格式不正确!<a href=""javascript:history.go(-1)"">重新上传</a></div>"
  else

   dim datename,datetime
   datetime=Now()   
   datename=year(datetime)&right("00"&month(datetime),2)&right("00"&day(datetime),2)&right("00"&hour(datetime),2)&right("00"&minute(datetime),2)&right("00"&second(datetime),2)     //以时间生成图片的新名称
    if isrename=1 then
   File.SaveAs savepath &"\"& datename & File.Ext  
    else
   File.SaveAs savepath &"\"& file.filename
    end if
   response.write "<script language=""javascript"">parent."&formname1&"."&inputname1&".value='"&UploadFilePath3&file.filename&"';"
   response.write "</script>"     
      if fileaction="movie" then  
   response.write "<script language=""javascript"">parent."&formname1&"."&inputname4&".value='"&replace(file.ext,".","")&"';"
   response.write "</script>"
      end if   
      if fileaction="article" then
   response.write "<script language=""javascript"">parent.document.all.d_width.value='"&file.ImageWidth&"';"
   response.write "</script>"
   response.write "<script language=""javascript"">parent.document.all.d_height.value='"&file.ImageHeight&"';"
   response.write "</script>"  
      end if   
       if issize=1 then      
       response.write "<script language=""javascript"">parent."&formname1&"."&inputname3&".value='"&formatnumber(file.size/1024,0)&"k';"
       response.write "</script>"
       end if  

    if islit=1 then
Dim sSmallPath   //缩略图名
sSmallPath = BuildSmallPic(UploadFilePath&file.filename,UploadFilePath2,picwidth,pichight)
select case sSmallPath
case "Error_01"
   response.write "<div style=""color:red;font-size:12px;"">Error_01:创建AspJpeg组件失败,没有正确安装注册该组件 <a href=""uploadfile.asp?big="&file.path&"&act=delete&action="&fileaction&""">删除</a></div>"
case "Error_02"
   response.write "<div style=""color:red;font-size:12px;"">Error_02:缩略图原图片不存在,检查s_OriginalPath参数传入值<a href=""uploadfile.asp?big="&file.path&"&act=delete&action="&fileaction&""">删除</a></div>"
case "Error_03"
   response.write "<div style=""color:red;font-size:12px;"">Error_03:缩略图存盘失败.可能原因:缩略图保存基地址不存在,检查s_OriginalPath参数传入值;对目录没有写权限;磁盘空间不足 <a href=""uploadfile.asp?big="&file.path&"&act=delete&action="&fileaction&""">删除</a></div>"
case else
  response.write "<script language=""javascript"">parent."&formname1&"."&inputname2&".value='"&UploadFilePath4&sSmallPath&"';"
  response.write "</script>"
  response.write "<div style=""color:green;font-size:12px;"">上传成功! <a href=""uploadfile.asp?big="&file.path&"&small="&savepath1&"\"&sSmallPath&"&act=delete&action="&fileaction&""" onclick=""parent."&formname1&"."&inputname1&".value='';parent."&formname1&"."&inputname2&".value=''"">删除</a></div>"
end select
      if isdel=1 then
      File.Delete
      end if
    else   
  response.write "<div style=""color:green;font-size:12px;"">上传成功!<a href=""uploadfile.asp?big="&file.path&"&act=delete&action="&fileaction&""" onclick=""parent."&formname1&"."&inputname1&".value=''"">删除</a></div>"
    end if
  end if   
 next
else
%>
<%
if request("act")="delete" then
  filename_1=Request.QueryString("big")
  filename_2=Request.QueryString("small")
 DeleteFile(filename_1)
 DeleteFile(filename_2)
end if
%>
<%
dim SPid,barref,UploadProgress
Set UploadProgress=Server.CreateObject("Persits.UploadProgress")
SPid=UploadProgress.CreateProgressID()
PID="PID=" & SPid
barref="framebar.asp?to=10&" & PID
%>

<SCRIPT LANGUAGE="JavaScript">
function ShowProgress()
{
 strAppVersion = navigator.appVersion;
 if (document.MyForm.FILE1.value != "")
 {
   if (strAppVersion.indexOf("MSIE") != -1 && strAppVersion.substr(strAppVersion.indexOf("MSIE")+5,1) > 4)
   {
     winstyle = "dialogWidth=375px; dialogHeight:175px; center:yes;status:no";
     window.showModelessDialog("<% = barref %>&b=IE",window,winstyle);
   }
   else
   {
     window.open("<% = barref %>&b=NN","","width=370,height=165", true);
   }
 }
 return true;
}
function chk()
{
 if (MyForm.FILE1.value=="")
 {
  alert("请从硬盘选择你要上传的文件...");
  return false;
 }
}
</SCRIPT>
<FORM NAME="MyForm" method="post" ENCTYPE="multipart/form-data" ACTION="?<%=PID%>&act=upload&action=<%=fileaction%>" OnSubmit="return ShowProgress();">
<INPUT NAME="FILE1" TYPE="FILE" SIZE="16"> <input name="Submit" type="submit" value="上 传" onClick="return chk()"></FORM>
<%end if%>
</body>
</html>
2011-05-30 15:06
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:20 
是否已安装这个上传组件?

----我怎能在别人的苦难面前转过脸去----
2011-05-30 15:10
快速回复:求教:高手解答 上传程序报错? ?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023940 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved