<!--#include file="../checkLogin.asp"-->
<!--#include file="../SQLconn.asp"-->
<html>
<head>
<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 

set FileObj=Upload.Files("file1") 


 
grade=Upload.Form("grade").value
subject=Upload.Form("subject").value
zhouci=Upload.Form("zhouci").value
ftype=Upload.Form("ftype").value
guanjianci=Upload.Form("guanjianci").value
zhangci=Upload.Form("zhangci").value
jieci=Upload.Form("jieci").value




filename=FileObj.FileName
fileContentType=FileObj.ContentType
flength=FormatNumber(FileObj.Size/1024/1024,2)



 

 


            dim fid 
			Set cmd = server.CreateObject("ADODB.Command")
			set Cmd.ActiveConnection = conn
			with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="AllID"
			   .execute
			   fid = .parameters("@id")
			end with

dim Rsfilesql
dim Rsfile
set Rsfile=server.createobject("adodb.recordset")
Rsfilesql="select * from subject where (id is null)" 

Rsfile.open Rsfilesql,conn,1,3
Rsfile.addnew
Rsfile("id")=fid
Rsfile("years")=request.cookies("nowxueqi")
Rsfile("subject")=subject
Rsfile("Grade")=Grade
Rsfile("ftype")=ftype
Rsfile("zhouci")=zhouci
Rsfile("guanjianci")=guanjianci
 

Rsfile("章次")=zhangci
 

Rsfile("节次")=jieci
Rsfile("title")=filename
Rsfile("updatetime")=now()
Rsfile("upname")=request.cookies("tname")
strip=Request.ServerVariables("REMOTE_ADDR")
Rsfile("upip")=strip
Rsfile.update
Rsfile.close


sql="select * from subjectfile where (id is null)"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
rs.addnew 
rs("fid")=fid
rs("filename")=filename
rs("fileContentType")=fileContentType
rs("filevalue").appendchunk FileObj.Binary
rs("FileLength")= flength
rs.update 
rs.close 

'response.redirect   "beike.asp?Grade="&Grade&"&subject="&subject&"&zhouci="&zhouci

%>

 
</p>

<p>&nbsp;</p>
<div align="center">
  <table border="1" cellspacing="0" width="383" bordercolorlight="#11B1FF" bordercolordark="#F0F8FF">
    <tr>
      <td width="100%" height="43" class="STYLE1">
      <p align="center" class="STYLE1 STYLE2">添加成功</td>
    </tr>
    <tr>
      <td width="100%" class="STYLE1">
        <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='beike.asp?Grade=<%=Grade%>&subject=<%=subject%>&zhouci=<%=zhouci%>'"  value="返回" />
        </div>
      </label>
      <div align="center"></div>
    </form>
    <p align="center"><br>
    <br>
    </p>
      </td>
    </tr>
  </table>
</div>
 

</body>  
  
</html>  


