www.gusucode.com > 掌柜网店购物系统 4.0码程序 > admin/upfile.asp

    <%OPTION EXPLICIT%>
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='login.asp';</script>"
response.End
end if
%>
<!--#include file="upload.inc"-->
<html><head><title>图片上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style>
BODY {
SCROLLBAR-FACE-COLOR: #e7e7e7;  
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #d4d0c8;
SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
SCROLLBAR-ARROW-COLOR:  #ffffff;
SCROLLBAR-TRACK-COLOR: #f7f7f7;
SCROLLBAR-DARKSHADOW-COLOR: #e7e7e7; 
}
.style3 {color: #FF6600}
</style>
</head>
<body>
<%
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
else
 formPath=upload.form("filepath")&year(now)&month(now)&"/"
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/"&year(now)&month(now)&"/" 
end if

iCount=0
for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(formPath&file.FileName)   ''保存文件
  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("../")&"\bookpic\"&year(now)&month(now)&"\"&spp
set fsobj=server.CreateObject("scripting.filesystemobject")

set fsobj=nothing
response.write "<center><input type=text size=40 value=bookpic/"&year(now)&month(now)&"/"&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
%>
</body>
</html>