<!--#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" href="css/css.css">
<title>保存文件</title>

<link rel="stylesheet" type="text/css" href="../css/style.css" />
</head>
<body  topmargin="5" leftmargin="5">

<p>
<%
Set Upload=Server.createobject("Persits.Upload.1") 
uploadlimitsize=10                                  '改变这个设置可以改变上传文件的大小限制，单位兆。
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




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") ="subjectid"
			   .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("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 

Upload.Dispose ' 释放内存 
Set Upload = Nothing 


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

%>

 <p><%=grade%><%=subject%><%=zhouci%><%=ftype%><%=guanjianci%>------------<%=filename%><%=fileContentType%><%=flength%></p>
</body>  
  
</html>  


