?? upload.asp
字號:
<!--#include file="upload_class.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上傳</title>
<style type="text/css">
TABLE {border:1px green solid;margin-top:5px;}
TD{border-bottom:1px #dddddd solid;height:20px;padding:3px 0 0 5px;}
.head{background-color:#eeeeee;}
</style>
</head>
<body style="font-size:12px">
請選擇一個文件進行上傳:<br />
<form name="upload" method="post" action="upload.asp?act=upload" enctype="multipart/form-data">
選擇文件:<input class="iFile" id="file1" type="file" name="file1" size="30" />
<input class="iButton" type="submit" value="上傳" />
</form>
<%
if request.querystring("act")="upload" then
Dim Upload,successful,str
str=""
'===============================================================================
set Upload=new AnUpLoad '創建類實例
Upload.SingleSize=200*1024 '設置單個文件最大上傳限制,按字節計;默認為不限制
Upload.MaxSize=200*1024 '設置最大上傳限制,按字節計;默認為不限制
Upload.Exe="rar|jpg|bmp|gif" '設置合法擴展名,以|分割,忽略大小寫
Upload.GetData() '獲取并保存數據,必須調用本方法
'===============================================================================
if Upload.Err>0 then '判斷錯誤號,如果myupload.Err<=0表示正常
response.write Upload.Description '如果出現錯誤,獲取錯誤描述
else
if Upload.forms("file1")<>"" then '這里判斷你file1是否選擇了文件
path=server.mappath("files") '文件保存路徑(這里是files文件夾)
set tempCls=Upload.files("file1")
successful=tempCls.SaveToFile(path,0) '以時間+隨機數字為文件名保存
'successful=tempCls.SaveToFile(path,1) '如果想以原文件名保存,請使用本句
if successful then
str="files/" & tempCls.FileName
end if
set tempCls=nothing
end if
end if
set Upload=nothing '銷毀類實例
if str<>"" then
%>
<script type="text/javascript">
window.opener.document.all.file1.value='<%=str%>';
window.opener=null;
window.close();
</script>
<%
end if
end if
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -