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

📄 saveupload.asp

📁 7k书城小偷程序。。。。。。。。。。。。。。。。。。。。。
💻 ASP
字号:
<%OPTION EXPLICIT%>
<!--#include file="UPfile.asp"-->

<%
if session("AdminName") = "" then
    response.Redirect "admin/Admin_Login.asp"
end if
%>

<%
dim upfile,formPath,ServerPath,FSPath,formName,FileName,oFile,upfilecount,FileExt
set upfile=new clsUp ''建立上传对象
upfile.AllowExt="gif;jpg;"	'设置上传类型的白名单
upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;php;php3;cgi;"	'设置上传类型的黑名单
upfile.GetData (1024000)   '取得上传数据,限制最大上传10M
%>



<html>
<head>
<script language="Javascript">
function pic(smileface)
{
	window.opener.document.form.pic.value=smileface;
}
</script>
<style type="text/css">
<!--
a {  font-family: "宋体"; font-size: 9pt; font-style: normal; line-height: 13pt; font-weight: normal; font-variant: normal; text-transform: none; color: #000000; text-decoration: none}
a:hover {  font-family: "宋体"; font-size: 9pt; font-style: normal; line-height: 13pt; font-weight: normal; font-variant: normal; text-transform: none; color: #000000; text-decoration: underline}
td {  font-family: "宋体"; font-size: 9pt; font-style: normal; line-height: 13pt; font-weight: normal; font-variant: normal; text-transform: none; color: #000000}
br {  font-family: "宋体"; font-size: 9pt; font-style: normal; line-height: 13pt; font-weight: normal; font-variant: normal; text-transform: none; color: #000000}
.bk { font-size: 9pt; border: 1px #082D71 solid}
body {  font-family: "宋体"; font-size: 9pt; font-style: normal; line-height: 13pt; font-weight: normal; font-variant: normal; text-transform: none}
.an {  font-family: "宋体"; font-size: 9pt; background-color: #F6f6f6; border: 1px #082D71 solid; color: #000000}
.xzy {  border: #082D71 solid; border-width: 0px 1px 1px}
.zx {  border: #082D71 solid; border-width: 0px 0px 1px 1px}
.sxz {  border: #082D71 solid; border-width: 1px 0px 1px 1px}
.s {  border: #082D71; border-style: solid; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px}
.y {  border: #082D71; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 0px}
.font {  font-family: "Arial Black"; font-size: 14pt; color: #000000}
.x {  border: #082D71; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px}
.z {  border: #082D71; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 1px}
.sx {  border: #082D71; border-style: solid; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px}
-->
</style>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr align="center">
    <td width=350>

<%
if upfile.isErr then  '如果出错
    select case upfile.isErr
	case 1
	Response.Write "你没有上传数据呀???是不是搞错了??"
	case 2
	Response.Write "<font color=#FF0000>你上传的文件超出我们的限制,最大10M</font>"
	end select
	else
%>

    <% 
	   FSPath=GetFilePath(Server.mappath("UPfile_qWERZA.asp"),"\") '取得当前文件在服务器路径
	   formpath="UPLOAD/"
	   for each formName in upfile.file  '列出所有上传了的文件
	   set oFile=upfile.file(formname)
	   filename=formpath&GetNewFileName()&"."&upfile.File(formname).FileExt   '取得上传文件信息
	   upfile.AutoSave formname,FSPath&FileName   '保存文件 也可以使用AutoSave来保存,参数一样,但是会自动建立新的文件名
	   if oFile.FileSize=0 then
       response.write"<SCRIPT language=JavaScript>alert('你没有上传文件呀!');"
       response.write"javascript:history.go(-1)</SCRIPT>"
       response.end
       end if
	 %>

      <font color="#FF0000">

      <%
     if upfile.iserr then
		Response.Write upfile.errmessage
		else
		Response.Write "<br>上传成功<br>"
		Response.Write "1、请点>>><a href=Javascript:pic('"&filename&"');>[完成]</a>;<br>2、再点>>>[<a href='javascript:window.close();'>[关闭]</a>]"
		end if
   set oFile=nothing
	next
	end if
set upfile=nothing  '删除此对象
%> 
   </font> 
  </td>
  </tr>
  </table>
</body>
</html>
<%
function GetFilePath(FullPath,str)
  If FullPath <> "" Then
    GetFilePath = left(FullPath,InStrRev(FullPath, str))
    Else
    GetFilePath = ""
  End If
End function

Function GetNewFileName()
	dim ranNum
	dim dtNow
	dtNow=Now()
	ranNum=int(90000*rnd)+10000
	GetNewFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function
%> 



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -