推薦:一個實用asp分頁函數分享一個asp分頁函數,感覺挺好看的。視圖如圖: 可以根據自己的情況修改,代碼: % '謝亮修分頁程序'call pagecontrol(記錄總數,頁碼總數,當前頁) Sub PageControl(iCount,pagecount,page) response.Write(style type=text/css/*謝亮分頁CSS*/div.pager{padding:10px
一款利用asp文件上傳組件把文件上傳到服務器之前進行判斷文件大小否超過指定大小了,本實例講的是upload_5xsoft文件上傳組件哦,file.filesize>1000000就可以限製文件為多少k。
dim upload,file,formname,formpath,icount,filename,fileext
set upload=new upload_5xsoft '建立上傳對象
formpath=download/ '在目錄後加(/)
if right(formpath,1)<>/ then formpath=formpath&/
for each formname in upload.file '列出所有上傳了的文件
set file=upload.file(formname) '生成一個文件對象
if file.filesize>1000000 then
message=1
else '如果filesize <20000 說明有文件數據
fileext=lcase(right(file.filename,4))
if fileext<>.exe and fileext<>.zip and fileext<>.rar and fileext<>.mxp then
message=2
else
randomize
rannum=int(90000*rnd)+10000
filename=formpath& lemongtree_ & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum&fileext
file.saveas server.mappath(filename) '保存文件
if fileext=.zip then
uploadtype = zip
elseif fileext=.rar then
uploadtype = rar
elseif fileext=.mxp then
uploadtype = mxp
elseif fileext=.exe then
uploadtype = exe
end if
uploadchar = filename
size = clng(file.filesize)/1000
message=3
end if
end if
next
%>
<% if message=1 then%>
<html>
<head>
<title>大小超標</title>
<meta http-equiv=content-type content=text/html; charset=gb2312>
<script language=網頁特效>
function error_size()
{
alert(文件大小超過1000kb,請重新選擇。);
window.location=upload.asp;
}
</script>
</head>
<body bgcolor=#f2f2f2 leftmargin=0 topmargin=0 onload=error_size()>
</body>
</html>
<% elseif message=2 then%>
<html>
<head>
<title>類型不匹配</title>
<meta http-equiv=content-type content=text/html; charset=gb2312>
<script language=javascript>
function error_type()
{
alert(只能上傳zip / rar / exe /mxp 文件n請選擇正確的文件類型!);
window.location=upload.asp;
}
</script>
</head>
<body bgcolor=#f2f2f2 leftmargin=0 topmargin=0 onload=error_type()>
</body>
</html>
<% elseif message=3 then%>
<html>
<head>
<title>上傳成功</title>
<meta http-equiv=content-type content=text/html; charset=gb2312>
<script language=javascript>
function image_success()
{
alert(文件上傳成功!);
parent.form1.url1.value=<%=uploadchar %>
parent.form1.size.value=<%=size%>k
window.location=upload.asp;
}
</script>
</head>
<body bgcolor=#f2f2f2 leftmargin=0 topmargin=0 onload=image_success()>
</body>
</html>
<% end if %>
<%
set file=nothing
set upload=nothing ''刪除此對象
%>
分享:網站製作ASP語言的特點與功能ASP(Active Server Page的縮寫) 意思是活動服務器網頁。 ASP是微軟公司開發,用於代替CGI腳本程序的一種應用. 它可以與數據庫和其它程序進行交互,是一種簡單,方便的編程工具。 ASP的網頁文件的格式為.asp,現常用於各種動態網站中。 ASP是一種服務器端腳本編寫環境,可以用