📄 aspupload.asp
字号:
<!--#include file="../chkuser.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/user.asp"-->
<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>
<%
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
PID = "PID=" & UploadProgress.CreateProgressID()
barref = "framebar.asp?to=10&" & PID
username=Request.Cookies("username")
dir=Request("path")
If dir = "" or Instr(dir,"..")>0 then
response.redirect("../error.asp?error=baderror")
Response.end
End if
checkpath="/"&Request.Cookies("username")
if lcase(checkpath)<>lcase(left(dir,len("/"&Request.Cookies("username")))) then
response.redirect("../error.asp?error=baderror")
response.end
end if
if rshost("ifupload")=False then
response.redirect("../error.asp?error=ifupload")
response.end
end if
%>
<script language="javascript">
function stopup(){
window.opener.focus();
window.close();
}
function check(){
i=1;
issel=0;
obj=document.MyForm;
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;}
document.MyForm.button.value='正在上传文件...'
document.MyForm.button.disabled=true;
ShowProgress()
}
var i=0;//全局计数变量
function Set1()
{var iCount,str;
iCount=window.MyForm.upcount.value
str='<td></td>';
if((!iCount)||(iCount==0))
{iCount=1;
window.MyForm.upcount.value=1;
}
if (iCount><%=rshost("filecount")%>)
{
window.MyForm.upcount.value=i-1;
alert("每次最大允许上传<%=rshost("filecount")%>个文件");
}
else
{window.MyForm.upcount1.value=0
for(i=1;i<=iCount;i++)
{
str+='<div align="right"><font color=#858585>●</font> 文件'+i+':<input type="file" name="file'+i+'" style="width:370" class="input"> </div>';
}
window.upid.innerHTML=str+'<td></td>';
}
return false;
}
function Set2()
{var iCount,iV;
iV=parseInt(window.MyForm.upcount1.value)
iCount=parseInt(window.MyForm.upcount.value)
if(iCount!=i-1)
{iCount=i-1;}
if (i><%=rshost("filecount")%>)
{
window.MyForm.upcount.value=<%=rshost("filecount")%>;
alert("每次最大允许上传<%=rshost("filecount")%>个文件");
}
else
{
if(i==1){i=2}
if(iV==1){iCount=1;window.MyForm.upcount1.value=0;}
{
window.MyForm.upcount.value=iCount+1;
window.upid.insertAdjacentHTML('beforeEnd','<div align="right"><font color=#858585>●</font> 文件'+i+':<input type="file" name="file'+i+'" style="width:370" class="input"> <br></div>');
}
}
i++;
return false;
}
function Set3()
{var iCount,str;
iCount=window.MyForm.upcount.value
str='<td></td>';
str+='<div align="right"><font color=#858585>●</font> 文件1:<input type="file" name="file1" style="width:370" class="input"> <br></div>';
window.upid.innerHTML=str+'<td></td>';
i=2;
window.MyForm.upcount.value=1;
}
//-->
function ShowProgress()
{
strAppVersion = navigator.appVersion;
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=375px; dialogHeight:150px; help:1;status:0;scroll:0";
window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=370,height=155', true);
}
}
return true;
}
</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="MyForm" METHOD="POST" ENCTYPE="multipart/form-data" ACTION="progress_upload.asp?<%=PID%>&dir=<%=dir%>" onSubmit="return check();">
<tr>
<td>
<li></li>
上传到:<%=path%></td>
</tr>
<tr>
<td height="28" colspan="2" align="center" bgcolor="#FFFFFF"> <font color=#858585>● </font> 上传文件数:
<input type="text" name="upcount" style="width:142" value="3" class="input">
<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> 文件1:
<input type="file" name="file1" style="width:370" class="input" value="">
</td>
</tr>
<script language="javascript">
Set3();
MyForm.upcount.value='3'
</script>
</table>
<input name="button" type=submit class="button" value="开始上传">
<input name="button" type=button class="button" onClick="stopup()" value="取 消"></td>
</tr>
</form>
</table>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -