?? admin_uploadfilesave.asp
字號:
<!--#include file="db/user.asp" -->
<!--#include file="admin/jl.asp" -->
<!--#include FILE="inc/upload_5xsoft.inc"-->
<tr>
<table border="1" width="755" cellspacing="0" cellpadding="1" bgcolor="<%=MainBgColor%>">
<tr>
<td align=center valign=top>
<table border="1" width="100%" cellspacing="0" cellpadding="0" Class="TableLine" bordercolorlight="<%=MainBColor%>" bgcolor="<%=MainCColor%>">
<tr>
<td width="100%" height="20" colspan=2 align=center bgcolor="<%=MainTColor%>"><b>上 傳 結 果</b></td>
</tr>
<tr>
<td width="100%">
<table width="100%" border="1" cellspacing="0" cellpadding="1" align="center" bgcolor="<%=MainBgColor%>">
<%
dim upload,file,formName,formPath,iCount
set upload=new upload_5xSoft ''建立上傳對象
if upload.form("filepath")="" then ''得到上傳目錄
%>
<script language=javascript>
history.back()
alert("請確認上傳目錄存在!沒有請在“網站資料管理”中添加")
</script>
<%
Response.End
else
formPath=upload.form("filepath")
''在目錄后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
end if
iCount=1
response.write "<tr align=center><td>源文件</td><td>文件大小</td><td>上傳路徑</td><td>目的文件</td><td>上傳結果</td></tr>"
for each formName in upload.file ''列出所有上傳了的文件
set file=upload.file(formName) ''生成一個文件對象
if file.fileName<>"" then
if getFileExtName(file.fileName)="asp" then
response.write "<tr align=center ><td>"&file.FileName&"</td><td>"&file.FileSize&"</td><td>-</td><td><font color=red>非法文件</font></td><td><font color=red>失敗!</font></td></tr>"
else
if file.FileSize>0 then ''如果 FileSize > 0 說明有文件數據
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
response.write "<tr align=center ><td>"&file.FileName&"</td><td>"&file.FileSize&"</td><td>"&Server.mappath(formPath)&"</td><td>"&file.FileName&"</td><td>成功!</td></tr>"
end if
end if
else
Response.Write "<tr align=center><td><font color=red>沒有選擇</font></td><td>-</td><td>-</td><td>-</td><td><font color=red>失敗!</font></td></tr>"
end if
iCount=iCount+1
set file=nothing
next
set upload=nothing ''刪除此對象
%>
</table></td></tr><td height='27' align='center'><%=iCount-1%>個文件上傳結束!</td></tr>
<%
'獲得文件的后綴名
function getFileExtName(fileName)
dim pos
pos=instrrev(filename,".")
if pos>0 then
getFileExtName=mid(fileName,pos+1)
else
getFileExtName=""
end if
end function
%>
</table>
</td>
</tr>
</table>
<%set rs=nothing%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -