
<!--#INCLUDE FILE="fupload.inc"-->
<!--#include file="../../SQLconn.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="../../css/style.css" />
<title>保存文件</title>

</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">

<p>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" Then
'---------------------------
'response.write "开始发送<br>"
'---------------------------
Dim Fields
UploadSizeLimit=8388808
Set Fields = GetUpload()
dim Field
For Each Field In Fields.Items

if Field.name="curpage" then curpage=BinaryToString(Field.value)
if Field.name="id" then id=BinaryToString(Field.value)

if Field.name="vname1" then vname1=BinaryToString(Field.value)
if Field.name="vname2" then vname2=BinaryToString(Field.value)
if Field.name="tname" then tname=BinaryToString(Field.value)
if Field.name="dateandtime" then dateandtime=BinaryToString(Field.value)
if Field.name="title" then title=BinaryToString(Field.value)
if Field.name="content" then content=BinaryToString(Field.value)


if Field.name="file1" then
filename=field.FileName

fileContentType=field.ContentType
filevalue=field.value
flength=FormatNumber(field.Length/1024/1024,2)
end if
next

'系统提示文件大小超出范围
if flength>20  then
 %>  
<div align="center" class="STYLE1 STYLE3" title="提示信息框">
                <span style="BACKGROUND:#EEEEFF;COLOR:#FF6633;margin: 10px;border:1px dotted #FF6633;
				 font-weight:bold;padding:18px;width=540">
                附件太大，系统设定不能上传大于20M的文件。</span>                 </div>
<%   
else


dim Rsfilesql
dim Rsfile
set Rsfile=server.createobject("adodb.recordset")
Rsfilesql="select * from SchoolWeb where   id='"&id& "'"

Rsfile.open Rsfilesql,conn,1,3

Rsfile("类别")=vname1
Rsfile("二级类别")=vname2
Rsfile("发布者")=tname
Rsfile("发布日期")=dateandtime

Rsfile("标题")=title
Rsfile("内容")=content
Rsfile("上传时间")=now()

Rsfile("上传人")=request.cookies("tname")
Rsfile("点击数")="0"

strip=Request.ServerVariables("REMOTE_ADDR")
Rsfile("上传机")=strip
Rsfile.update
Rsfile.close



sql="select * from SchoolWebFile where (id is null)"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
rs.addnew 

IF  filename<>"" THEN
rs("fid")=id
rs("文件名")=filename
rs("文件类型")=fileContentType
rs("文件内容").appendchunk filevalue
rs("文件长度")= flength
rs.update 
rs.close 
end if


%>


</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align="center">
  <table border="1" cellspacing="0" width="283" bordercolorlight="#11B1FF" bordercolordark="#F0F8FF">
    <tr>
      <td width="100%" height="20">
      <p align="center" class="STYLE1 STYLE2">添加成功</td>
    </tr>
    <tr>
      <td width="100%">
        <p align="left"><br>
          <br><%=id%>
        文件为：
        <%response.write filename%></p>
    <center>
    <form name="form1" method="post" action="">
      <label>
        <div align="center">&nbsp;
		  
		   <input name="button" type="button" class="topanniu" onClick="location='manage.asp?curpage=<%=curpage%>'"  value="返回" />
        </div>
      </label>
      <div align="center"></div>
    </form>
    <p align="center"><br>
    <br>
    </p>
      </td>
    </tr>
  </table>
</div>
  <%end if
  end if 
  %>
</body>  
  
</html>  


