
<!--#include file="conn.asp" -->
<% adm_power_page=1 '分配本页的用户访问权限 %>
<!--#include file="admin_dn.asp" -->
<!--#include file="upload.inc"-->

<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bgcolor="#E8F1FF">
<p align="center"> 
  <%
dim upload,file,formName,formPath,iCount,sname

set upload=new upload_5xSoft ''建立上传对象

response.write upload.Version&""  ''显示上传类的版本

if upload.form("filepath")="" then   ''得到上传目录
 HtmEnd "请输入要上传至的目录!"
 set upload=nothing
 response.end
end if

formPath=upload.form("filepath")
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/" 


iCount=0
for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
 
  response.write "<br><center><font size=2 color=red>上传成功，请复制下边剪切板中内容而后粘贴到图书图片剪切板内!</font></center><br>"
 dim thename,fsobj,spp,paths
'文件更名
thename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.filename,4)
'response.write thename
spp=file.filename
file.filename=thename
file.SaveAs Server.mappath(formPath&file.FileName)
paths=server.mappath("../")&"\upfile\"&year(now)&month(now)&"\"&spp
set fsobj=server.CreateObject("scripting.filesystemobject")
if fsobj.fileExists(""&paths&"") then
fsobj.deletefile(""&paths&"")
end if
set fsobj=nothing
response.write "<center><input type=text size=26 value=upfile/"&file.filename&"><button onclick=window.clipboardData.setData('text',this.previousSibling.value)>复制</button><br><br><a href='javascript:window.close()'><font color=red size=2>关闭窗口</font></a></center>"
  iCount=iCount+1
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象
response.write "<font color=red size=2>"
'Htmend iCount&" 个文件上传成功!</font>"

sub HtmEnd(Msg)
 set upload=nothing
 response.write "<br>"&Msg&" [<a href='javascript:window.close()'><font color=red size=2>关闭窗口</font></a>]</body></html>"
 response.end
end sub
Function GetPP
	dim s
	s=Request.ServerVariables("path_translated")
	GetPP=left(s,instrrev(s,"\",len(s)))
End function
%>
  <font color="#FF0000" size="2">注：这里的文件路径是相对网站前台所在目录．</font></p>
</body>
</html>