| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 469 人关注过本帖
标题:没有MTS 对象上下文!
只看楼主 加入收藏
罗林鹏
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2010-7-2
结帖率:100%
收藏
 问题点数:0 回复次数:0 
没有MTS 对象上下文!
程序代码:
<%
if session("flag")=3 then
response.Write "<p align=center><font color=red>您没有此项目管理权限!</font></p>"
response.End
end if
uppath=request("uppath")&"/"            '文件上传路径
filelx=request("filelx")                '文件上传类型
formName=request("formName")            '回传到上页面编辑框所在Form的Name
EditName=request("EditName")            '回传到上页面编辑框的Name
%>
<html><head><title>图片上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function mysub()
{
        esave.style.visibility="visible";
}
-->
</script>
</head>
<body>
<form name="form1" method="post" action="scwjs.asp" enctype="multipart/form-data" >
<div id="esave" style="position:absolute; top:18px; left:40px; z-index:10; visibility:hidden"> 
<TABLE WIDTH=340 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR><td width=20%></td>
<TD bgcolor=#ff0000 width="60%"> 
<TABLE WIDTH=100% height=120 BORDER=0 CELLSPACING=1 CELLPADDING=0>
<TR> 
<td bgcolor=#ffffff align=center><font color=red>正在上传文件,请稍候...</font></td>
</tr>
</table>
</td><td width=20%></td>
</tr></table></div>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr> 
<td align="center" background="images/admin_bg_1.gif"><b><font color="#ffffff">图片上传 
<input type="hidden" name="filepath" value="<%=uppath%>">
<input type="hidden" name="filelx" value="<%=filelx%>">
<input type="hidden" name="EditName" value="<%=EditName%>">
<input type="hidden" name="FormName" value="<%=formName%>">
<input type="hidden" name="act" value="uploadfile"></font></b>
</td>
</tr>
<tr bgcolor="#E8F1FF"> 
<td align="center" id="upid" height="80">选择文件: 
<input type="file" name="file1" size="40" class="tx1" value="">
<input type="submit" name="Submit" value="开始上传" class="button" onClick="javascript:mysub()">
</td>
</tr>
</table>
</form>
</body>
</html>

程序代码:
<%
dim Upload,ofile,ext,myfile
Set Upload = Server.CreateObject("Persits.Upload")
Upload.SetMaxSize 10000000, True
Count=Upload.Save  '这里是上传到服务器内存,并没有实际文件产生
if Count=0 then 
response.write"<script language=javascript>alert("&"'请先选择图片!'"&");history.go(-1);</script>"
response.end
end if
filepath=trim(upload.form("filepath"))
set ofile = Upload.files(1)
ext=killext(ofile.ext)
myfile=filepath&gname(2) & ext
call ofile.saveas(server.mappath(myfile))
FilePath=server.mappath(myfile)
set MyFile1 = server.CreateObject("Scripting.FileSystemObject")
set MyText = MyFile1.OpenTextFile(FilePath, 1) '读取文本文件
sTextAll = lcase(MyText.ReadAll)
MyText.close
set MyFile1 = nothing
sStr=".getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language="
sNoString = split(sStr,"|") 
for i=0 to ubound(sNoString)
   if instr(sTextAll,sNoString(i)) then
     set filedel = server.CreateObject("Scripting.FileSystemObject")
     filedel.deletefile FilePath
     set filedel = nothing
     Response.Write("<script>alert('您上传的文件有问题,上传失败');window.close();</script>")
     Response.End()
   end if
next
%>


<%

 

 
  response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&myfile&"'</script>"
%>

<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址!");
window.close();
</script>
<%function killext(byval s1) '干掉非法文件后缀
dim allowext
allowext=".JPG,.JPEG,.GIF,.BMP,.PNG"
s1=ucase(s1)
if len(s1)=0 then
  killext=""
else
  if not chk(allowext,s1,",") then
   killext=".shit"

 response.write"<script language=javascript>alert("&"'不允许上传的文件格式,您可以上传的文件格式是:jpg,jpeg,bmp,gif,png!'"&");history.go(-1);</script>"

 response.end

   
  else
   killext=s1
  end if
end if
end function

function chk(byval s1,byval s2,byval fuhao) '检查字符串包含
dim i,a
chk=false
a=split(s1,fuhao)
for i = 0 to ubound(a)
  if trim(a(i))=trim(s2) then 
   chk=true
   exit for
  end if
next
end function

function gname(byval n1) '以日期自动产生目录和文件名,参数1生成目录,参数2生成文件名(无后缀)
dim t,r
t=now()
randomize(timer)
r=int((rnd+1-1)*9999)
select case n1
case 1
gname=year(t)&right("00"&month(t),2)&right("00"&day(t),2)
case 2
gname=right("00"&hour(t),2)&right("00"&minute(t),2)&right("00"&second(t),2)&right("0000"&r,4)
end select
end function

%>

一个asp上传页面。。。每次上传 都是提示

Persits.Upload.1 '800a0043'

没有 MTS 对象上下文


在线等!!
搜索更多相关主题的帖子: 上下文 color 
2011-11-04 11:00
快速回复:没有MTS 对象上下文!
数据加载中...
 
   



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

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