www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > admin/upfile.asp

    <!--#include file="config.asp" -->
<%
dim SPid,PID,barref,UploadProgress
on error resume next 
if uploadapi=1 then
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
SPid = UploadProgress.CreateProgressID()
PID = SPid
barref="framebar.asp?to=10&pid="&PID
end if

dim lx,up,tab,f1,f2,f3,bj
lx=Trim(Request.QueryString("lx"))
up=Trim(Request.QueryString("up"))
tab=Trim(Request.QueryString("tab"))
f1=Trim(Request.QueryString("f1"))
f2=Trim(Request.QueryString("f2"))
f3=Trim(Request.QueryString("f3"))
bj=Trim(Request.QueryString("bj"))

dim atype,strlx

select case lx
case 1
atype=pictype
strlx="图片"
case 2
atype=mediatype
strlx="媒体"
case 3
strlx="压缩文件"
atype=ziptype
case 4
strlx="文本文件"
atype=texttype
case 5
strlx="其他文件"
atype=othertype
case 6
atype=othertype&"|"&pictype&"|"&mediatype&"|"&ziptype&"|"&txttype&"|"&othertype
end select
if atype<>"" then 
if right(atype,1)="|" then
atype=lcase(left(atype,len(atype)-1))
end if
end if

%>
<SCRIPT LANGUAGE="JavaScript">
<% if uploadapi=1 then %>
function ShowProgress()
{
strAppVersion = navigator.appVersion;
if (document.form1.file.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;
}
<% End If %>
function chk()
{
if (GE("file").value=="")
{
alert("请从硬盘选择你要上传的文件...");
return false;
}
else
{
var str=GE("file").value.split(".");
var ext=str[str.length-1].toLowerCase();
var atype="<%= atype %>";
if(atype=="")
{
alert("您还没有设置任何允许上传[<%= strlx %>]的文件类型,请先设置");
return false;
}
else
{
var chk=false;
var str1=atype.split("|");
for(var i=0;i<=str1.length;i++)
{
if(str1[i]==ext)
{
chk=true;
}
}
if(chk==false)
{
alert("对不起!不允许上传此文件类型");
return false;
}
}
}

}
</SCRIPT>

<html>
<head>
<title>文件上传</title>
<link href="inc/mm.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form action="upload.asp?pid=<%= PID %>&lx=<%= lx %>&id=<%= id %>&up=<%= up %>&tab=<%= tab %>&f1=<%= f1 %>&f2=<%= f2 %>&f3=<%= f3 %>&bj=<%= bj %>" method="post" enctype="multipart/form-data" name="form1" <% if uploadapi=1 then %>OnSubmit="return ShowProgress();"<% End If %>>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center"><br>
<input name="file" type="file" class="inp" size="32" onFocus="this.className='focus'" onBlur="this.className='inp'">
<input name="up" type="submit" class="btn2" id="up" value="上传" onClick="return chk();"></td></tr>
</table>
</form>
</body>
</html>