<!--#include file="../checkLogin.asp"-->
<!--#include file="../SQLconn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存文件</title>

<link rel="stylesheet" type="text/css" href="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>
</head>
<body  topmargin="5" leftmargin="5">

<p>
	<%
	Set Upload=Server.createobject("Persits.Upload.1") 
	uploadlimitsize=request.cookies("filelength")   '改变这个设置可以改变上传文件的大小限制，单位兆。  
	Upload.SetMaxSize uploadlimitsize*1024*1024, True 
	Upload.Save  
	if err.number <> 0 then 
	response.write  "出现错误: " & err.number & "、" & err.description &"" 
	end if 
	if err.number = 8 then 
	response.write " 你上传的文件超过限制（"& uploadlimitsize &"兆）<a href=""javascript:history.go(-1)"">重新上传</a>" 
	response.end 
	end if 


		bumen=Upload.Form("bumen").value
		ftype=Upload.Form("ftype").value
		tname=Upload.Form("tname").value
		guanjianci=Upload.Form("guanjianci").value
		
		set FileObj1=Upload.Files("file1") 
		filename=FileObj1.FileName
	  

		dim Rsfilesql
		dim Rsfile
		set Rsfile=server.createobject("adodb.recordset")
		Rsfilesql="select * from bumenfile where (id is null)" 
		
		Rsfile.open Rsfilesql,conn,1,3
		Rsfile.addnew
		
		Rsfile("years")=request.cookies("nowxueqi")
		Rsfile("bumen")=bumen
		Rsfile("ftype")=ftype
		Rsfile("title")=FileObj1.FileName
		
		Rsfile("author")=tname
		Rsfile("fdate")=now()
		Rsfile("content")=guanjianci
		
		Rsfile("updatetime")=now()
		Rsfile("upname")=request.cookies("tname")
		strip=Request.ServerVariables("REMOTE_ADDR")
		Rsfile("upip")=strip
		Rsfile.update
		Rsfile.close
		
		
		
		strSQL = "SELECT @@IDENTITY AS NewID" 
		Set Rsid = Conn.Execute(strSQL) 
		NewID = Rsid.Fields("NewID").value 
		
		
		sql="select * from bumenfilevalue where (id is null)"
		Set rs= Server.CreateObject("ADODB.Recordset")
		rs.open sql,conn,1,3
		rs.addnew 
		
		rs("fid")=NewID
		rs("filename")=FileObj1.FileName
		rs("fileContentType")=FileObj1.ContentType
		rs("filevalue").appendchunk FileObj1.Binary
		rs("FileLength")= FormatNumber(FileObj1.Size/1024/1024,2)
		rs.update 
		rs.close 
		
			 
		Upload.Dispose ' 释放内存 
		Set Upload = Nothing 
%>


</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>
        文件为：
        <%response.write filename%></p>
    <center>
    <form name="form1" method="post" action="">
      <label>
        <div align="center">
          <input name="button" type="button" class="topanniu" onClick="location='addfile.asp?years=<%=request.cookies("nowxueqi")%>&bumen=<%=bumen%>&ftype=<%=ftype%>'"  value="继续" />
          &nbsp;&nbsp;&nbsp;&nbsp;
		  
		   <input name="button" type="button" class="topanniu" onClick="location='manage.asp?years=<%=request.cookies("nowxueqi")%>'"  value="返回" />
        </div>
      </label>
      <div align="center"></div>
    </form>
    <p align="center"><br>
    <br>
    </p>
      </td>
    </tr>
  </table>
</div>
 
</body>  
  
</html>  


