一款利用asp文件上傳組件把文件上傳到服務器之前進行判斷文件大小否超過指定大小了
dim upload
set upload=new upload_
formpath="download/"
if right(formpath
for each formname in upload
set file=upload
if file
message=
else
fileext=lcase(right(file
if fileext<>"
message=
else
randomize
rannum=int(
filename=formpath& "lemongtree_" & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum&fileext
file
if fileext="
uploadtype = "zip"
elseif fileext="
uploadtype = "rar"
elseif fileext="
uploadtype = "mxp"
elseif fileext="
uploadtype = "exe"
end if
uploadchar = filename
size = clng(file
message=
end if
end if
next
%>
<% if message=
<html>
<head>
<title>大小超標</title>
<meta http
<script language=網頁特效>
function error_size()
{
alert("文件大小超過
window
}
</script>
</head>
<body bgcolor="#f
</body>
</html>
<% elseif message=
<html>
<head>
<title>類型不匹配</title>
<meta http
<script language=javascript>
function error_type()
{
alert("只能上傳 zip / rar / exe /mxp 文件n請選擇正確的文件類型!");
window
}
</script>
</head>
<body bgcolor="#f
</body>
</html>
<% elseif message=
<html>
<head>
<title>上傳成功</title>
<meta http
<script language=javascript>
function image_success()
{
alert("文件上傳成功!");
parent
parent
window
}
</script>
</head>
<body bgcolor="#f
</body>
</html>
<% end if %>
<%
set file=nothing
set upload=nothing
%>
From:http://tw.wingwit.com/Article/program/net/201311/14285.html