<!--#include FILE="inc/uploadFile.inc"-->
<%
pno=request.serverVariables("HTTP_X_UP_CALLING_LINE_ID")
pno=right(pno,11)
npno=right(pno,4)
If pno="" Then
pno=request.serverVariables("Remote_host")
npno="Computeruser"
End if


dim conn   
dim connstr
connstr="DBQ="+server.mappath("../MyDatabase/#Company.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
''''''''''''''''''''''''''''''
dim upload,file,formName,formPath,iCount
Dim sjs,fname,i,l,newfilelist,uploaddir,filename,ii

RANDOMIZE
sjs=INT((99-00+1)*RND+00)
fname=year(date)&month(date)&day(date)&hour(time())&minute(time())&second(time())&sjs
dataid=fname

Server.ScriptTimeOut=999999
fullpath=Server.Mappath("../") & "/" '修改。


set upload=new upload_5xsoft 
title=upload.form("title")
explain=upload.form("explain")
thefiletype=upload.form("thefiletype")
if upload.form("filepath")="" then   ''得到上传目录

 Response.write "<script language='javascript'>alert('系统提示：\n\n请输入要上传至的目录!');location.href='javascript:history.back()'</script>"
 set upload=nothing
 response.end
else
 formPath=upload.form("filepath")
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/" 
end if
iCount=0
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
size=file.filesize
''--------------
filetype=file.filename
i=InStr(filetype,".")
l=Len(filetype)
If i>0 Then
  filetype=Right(filetype,l-i+1)
End If
fname=fname&filetype
newfilelist=fullpath&formPath&fname
%>
<%
sq1="select * from UpLoadData where size='"&size&"'"
Set Rs1 = Server.CreateObject("Adodb.Recordset")
rs1.open sq1,conn,1,2

If rs1.bof Or rs1.eof Then

 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs newfilelist   ''保存文件
  iCount=iCount+1
msg="文件上传成功！"
  End  If
rs1.addnew
	rs1("dataname")=fname
	rs1("datadir")=formPath&fname
	rs1("title")=title
	rs1("explain")=explain
	rs1("addtime")=Now()
	rs1("size")=size
	rs1("type")=thefiletype
	rs1.update
	rs1.close

sq2="select * from UpLoadData where dataname='"&fname&"'"
Set Rs2 = Server.CreateObject("Adodb.Recordset")
rs2.open sq2,conn,1,2

Else
msg="文件已存在！"

sq2="select * from UpLoadData where size='"&size&"'"
Set Rs2 = Server.CreateObject("Adodb.Recordset")
rs2.open sq2,conn,1,2
fname=rs2("dataname")
End if
set file=nothing
next
set upload=nothing  '删除此对象

%>

<html>
<head>
<title>文件上传结果</title>
<style type="text/css">
<!--
td {
	font-size: 12px;
	color: #000000;
}
a:link {
	font-size: 12px;
	color: #000000;
	text-decoration: none;
}
a:visited {
	font-size: 12px;
	color: #000000;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #000000;
	text-decoration: underline;
}
.input {
	BORDER-RIGHT: #eaeaea 1px solid;
	BORDER-TOP: #9e9e9e 1px solid;
	FONT-SIZE: 9pt;
	BORDER-LEFT: #9e9e9e 1px solid;
	COLOR: #000000;
	BORDER-BOTTOM: #eaeaea 1px solid;
	BACKGROUND-COLOR: #FFFFFF;

}
.button {
BORDER-RIGHT: #9e9e9e 1px solid; BORDER-TOP: #eaeaea 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #eaeaea 1px solid; COLOR: #000000; BORDER-BOTTOM: #9e9e9e 1px solid; BACKGROUND-COLOR: #FFFFFF;cursor:hand;
}
textarea, select {border: 1 solid #000000;background-color: #; font-size: 12px;}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#DEDFDE">
      <tr bgcolor="#f7f7f7"> 
        <td bgcolor="#f7f7f7"><P align="center">图铃上传系统</P></td>
      </tr>
      <tr bgcolor="#f7f7f7">
        <td><br> <br> <table width="30%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="999999">
            <tr> 
              <td align="center"  bgcolor="#ffffff"><font color="#FF0000"><%=msg%></font></td>
            <tr> 
              <td   bgcolor="#ffffff"> 标题：<%=rs2("title")%> </td>
            </tr>
            <%filetype=LCase(filetype)
if filetype=".jpg" or filetype=".gif" or filetype=".bmp" or filetype=".png" or filetype=".jpge" then%>
            <tr> 
              <td align="center"  bgcolor="#ffffff"> <img src="<%="../" & formPath %><%=fname%>"/> 
              </td>
            </tr>
            <%end if%>
            <tr> 
              <td  bgcolor="#ffffff"> 描述：<%=rs2("explain")%> </td>
            </tr>
            <tr> 
              <td  bgcolor="#ffffff"> 大小：<%=size%>bytes </td>
            </tr>
            <tr> 
              <td  bgcolor="#ffffff"> 文件路径：<a href="<%=  "../" & formPath %><%=fname%>"><%=   "../" & formPath%><%=fname%></a> 
              </td>
            </tr>
            <tr> 
              <td align="center"  bgcolor="#ffffff"><input name="button" type=button class="bt1" onclick="javascript:history.back()" value=继续上传> 
                <input name="button2" type=button class="bt1" onclick="window.close();" value=关闭></td>
            </tr>
          </table>
          <p>　</p>
          <p>
            <script language=javascript>
if(window.opener&&window.opener.refreshit)
 window.opener.refreshit();
</script>
          </p></td>
      </tr>
    </table>
<br>
</BODY>
</HTML>
