⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upload.asp

📁 使用Asp+Access+FSO+Jmail+Servu开发
💻 ASP
字号:
<!--#include file="../chkuser.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/user.asp"-->
<%
username=Request.Cookies("username")
path=request("path")
if rshost("ifupload")=False then
response.redirect("../error.asp?error=ifupload")
response.end
end if
If path = "" or Instr(path,"..")>0 then
response.redirect("../error.asp?error=baderror")
Response.end
End if
checkpath="/"&Request.Cookies("username")
if lcase(checkpath)<>lcase(left(path,len("/"&Request.Cookies("username")))) then
response.redirect("../error.asp?error=baderror")
response.end
end if
%>
<html>
<head>
<title>上传文件</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../js/title.js"></script>
<script language="javascript">
function check(){
 i=1;
 issel=0;
 obj=document.form1;
 while(eval('obj.file'+i))
 {
  obj1=eval('obj.file'+i);
  if(obj1.value!="")
   {issel=1;break;}
  i++;
 }
 if(!issel)
 {alert('请先选择要上传的文件。');
 obj.file1.focus();
 return false;}
Loading=true;
document.form1.button.value='正在上传文件...'
document.form1.button.disabled=true;
divProcessing.style.display="";
return true;
}
var i=0;//全局计数变量 
function Set1()
	{var iCount,str;
	iCount=window.form1.upcount.value
	str='<td></td>';
	if((!iCount)||(iCount==0))
		{iCount=1;
		window.form1.upcount.value=1;
		}
	if (iCount><%=rshost("filecount")%>)
		{
		window.form1.upcount.value=i-1;
		alert("每次最大允许上传<%=rshost("filecount")%>个文件");
		}
	else
		{window.form1.upcount1.value=0
		for(i=1;i<=iCount;i++)
			{
			str+='<div align="right"><font color=#858585>●</font>&nbsp;文件'+i+':<input type="file" name="file'+i+'" style="width:370" class="input">&nbsp;&nbsp;</div>';
			}
			window.upid.innerHTML=str+'<td></td>';
		}
		return false;
	}

function Set2()
   {var iCount,iV;
	iV=parseInt(window.form1.upcount1.value)
	iCount=parseInt(window.form1.upcount.value)
	if(iCount!=i-1)
		{iCount=i-1;}		
	if (i><%=rshost("filecount")%>)
		{
		window.form1.upcount.value=<%=rshost("filecount")%>;
		alert("每次最大允许上传<%=rshost("filecount")%>个文件");
		}
	else
		{
			if(i==1){i=2}
			if(iV==1){iCount=1;window.form1.upcount1.value=0;}
			{
			window.form1.upcount.value=iCount+1;
			window.upid.insertAdjacentHTML('beforeEnd','<div align="right"><font color=#858585>●</font>&nbsp;文件'+i+':<input type="file" name="file'+i+'" style="width:370" class="input">&nbsp;&nbsp;<br></div>');
			}
		}
	i++;
	return false;
	}
	
function Set3()
		{var iCount,str;
			iCount=window.form1.upcount.value	
			str='<td></td>';
			str+='<div align="right"><font color=#858585>●</font>&nbsp;文件1:<input type="file" name="file1" style="width:370" class="input">&nbsp;&nbsp;<br></div>';
			window.upid.innerHTML=str+'<td></td>';
			i=2;
			window.form1.upcount.value=1;
		}
//-->	
function stopup(){
	window.opener.focus();
	window.close();
}
function window::onbeforeunload(){
if (Loading)
	if (event.clientY<0 && event.clientX>document.body.clientWidth-20
		|| event.clientY<0 && event.clientX<20
		|| event.altKey 
		|| event.clientY>document.body.clientHeight)
			event.returnValue="正在上传文件,如果强行退出,将终止文件上传!";
}
//设置上传文件时的LOADING效果
			str="......";
			timeout=130;
			setTimeout("loading(2)",timeout); 
			function loading(poitcount){
				Pcount=poitcount;
				Pcount=Pcount%8;
				if(Pcount==0) Pcount++
				window.maindiv.innerHTML=" 文件上传中,请等待"+str.substring(0,Pcount);
				Pcount++;
				setTimeout("loading("+Pcount+")",timeout);
			}
</script>
</head>
<body oncontextmenu="return false";return true" onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
<table width="400" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="cccccc">
      <form name=form1 action="upfile.asp" method="post" enctype="multipart/form-data" onSubmit="return check()">
        <input name="filepath" type="hidden" value="<%=path%>">
        <tr>
          <td>
            <li></li>
            上传到:<%=path%></td>
        </tr>
        <tr>
          <td height="28" colspan="2" align="center" bgcolor="#FFFFFF">&nbsp;<font color=#858585>● </font> 上传文件数:
              <input type="text" name="upcount" style="width:142" value="3" class="input">
&nbsp;
        <input type="button" name="Button0" class="button" onClick="Set1();" value=" 设 定 ">
        <input name="Button2" type=Button class="button" onClick="return Set2();" value="增加文件">
        <input type="reset" name="Submit222" class="button" onClick="Set3();" value=" 重 置 ">
        <input type="hidden" name="upcount1" value="1" >
          </td>
        </tr>
        <tr align="center" bgcolor="eeeeee">
          <td><table width="461" height="100%" border="0" align="center" cellpadding="4" cellspacing="0">
              <tr align="right" valign="middle">
                <td height="" id="upid"><font color=#858585>●</font>&nbsp;文件1:
                    <input type="file" name="file1" style="width:370" class="input" value="">
&nbsp;&nbsp;</td>
              </tr>
              <script language="javascript">
	Set3();
	form1.upcount.value='3'
      </script>
            </table>
              <input name="button" type=submit class="button" value="开始上传">
              <input type=button class="button" onClick="stopup()" value="取 消"></td>
        </tr>
      </form>
    </table>
<div id=divProcessing style="width:200px;height:30px;position:absolute;left:150px;top:185px;display:none">
<table border=0 cellpadding=0 cellspacing=1 bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#3A6EA5 style="color:#ffffff"><div id=maindiv>文件上传中,请等待.</div></td></tr></table>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -