⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_uploadsave.asp

📁 庐江二中
💻 ASP
字号:
<%PageName="admin_upload"%>
<!--#include file="session.asp"-->
<%checkAdmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="top.asp"-->
<!--#include FILE="inc\upload_5xsoft.inc"--><br>
<table border="1" width="80%" 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%>" background="images/admin/b3.gif"><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,newsid
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
newsid=upload.form("newsid")
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 instr("gif,bmp,jpg,swf,png",getFileExtName(file.fileName))=0 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& NewsID & "-" & cstr(iCount)&"."& getFileExtName(file.fileName))   ''保存文件
response.write "<tr align=center ><td>"&file.FileName&"</td><td>"&file.FileSize&"</td><td>"&Server.mappath(formPath)&"</td><td>"&NewsID & "-" & cstr(iCount)&"."& getFileExtName(file.fileName)&"</td><td>成功!</td></tr>"
else
response.write "<tr align=center ><td>"&file.FileName&"</td><td>0</td><td>-</td><td>-</td><td><font color=red>失败!</font></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 + -