
<!--#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">

<title>保存文件</title>

<link rel="stylesheet" href="../css/style.css">

<style type="text/css">
<!--
.STYLE2 {color: #000000}
-->
</style>
</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="subject" then subject=BinaryToString(Field.value)
if Field.name="teacher" then teacher=BinaryToString(Field.value)
if Field.name="dateandtime" then dateandtime=BinaryToString(Field.value)
if Field.name="title" then title=BinaryToString(Field.value)
 


if Field.name="file1" then
filename1=field.FileName
fileContentType1=field.ContentType
filevalue1=field.value
flength1=FormatNumber(field.Length/1024/1024,2)
end if

if Field.name="file2" then
filename2=field.FileName
fileContentType2=field.ContentType
filevalue2=field.value
flength2=FormatNumber(field.Length/1024/1024,2)
end if

if Field.name="file3" then
filename3=field.FileName
fileContentType3=field.ContentType
filevalue3=field.value
flength3=FormatNumber(field.Length/1024/1024,2)
end if

if Field.name="file4" then
filename4=field.FileName
fileContentType4=field.ContentType
filevalue4=field.value
flength4=FormatNumber(field.Length/1024/1024,2)
end if

if Field.name="file5" then
filename5=field.FileName
fileContentType5=field.ContentType
filevalue5=field.value
flength5=FormatNumber(field.Length/1024/1024,2)
end if





next

if flength1>request.cookies("filelength")  or flength2>request.cookies("filelength")  or flength3>request.cookies("filelength")  or flength4>request.cookies("filelength")  or flength5>request.cookies("filelength")  then
 %>  
<div align="center" class="STYLE1" title="提示信息框">
                <span style="BACKGROUND:#EEEEFF;COLOR:#FF6633;margin: 10px;border:1px dotted #FF6633;
				 font-weight:bold;padding:18px;width=540">
                单个附件太大，系统设定单个附件不能上传大于 <%=request.cookies("filelength")%> M的文件。</span>                 </div>
<%   
else
			dim rsgonggaosql
			dim rsgonggao
			
			dim filename
			
			
			dim strdateandtime
			if  dateandtime<>"" then
			   strdate=cdate(dateandtime)
			else  
			   strNow=now()
			 end if

			
			'从存储过程取得gonggaoid
			dim fid 
			Set cmd = server.CreateObject("ADODB.Command")
			set Cmd.ActiveConnection = conn
			with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="作业布置ID"
			   .execute
			   fid = .parameters("@id")
			end with

              ''分开部门字段
              dim mysendto
		      mysendto=split(sendto,"|")


			
			set rsgonggao=server.createobject("adodb.recordset")
			rsgonggaosql="select * from zuoyebuzhi where (id is null)" 
			
			rsgonggao.open rsgonggaosql,conn,1,3
			rsgonggao.addnew
			
			rsgonggao("id")=fid
			rsgonggao("学期")=request.cookies("nowxueqi")
			rsgonggao("科目")=subject
			rsgonggao("教师")=teacher
			rsgonggao("时间")=dateandtime
			rsgonggao("标题")=title
			 
			rsgonggao.update
			
			 
			
			
			IF  filename1<>"" THEN
						sql="select * from zuoyebuzhiFile where (id is null)"
						Set rs= Server.CreateObject("ADODB.Recordset")
						rs.open sql,conn,1,3
						rs.addnew 
						rs("fid")=fid
						rs("filename")=filename1
						rs("fileContentType")=fileContentType1
						rs("filevalue").appendchunk filevalue1
						rs("FileLength")= flength1
						rs.update 
						rs.close 
			end if 
			
			IF  filename2<>"" THEN
						sql="select * from zuoyebuzhiFile where (id is null)"
						Set rs= Server.CreateObject("ADODB.Recordset")
						rs.open sql,conn,1,3
						rs.addnew 
						rs("fid")=fid
						rs("filename")=filename2
						rs("fileContentType")=fileContentType2
						rs("filevalue").appendchunk filevalue2
						rs("FileLength")= flength2
						rs.update 
						rs.close 
			end if 
			
			IF  filename3<>"" THEN
						sql="select * from zuoyebuzhiFile where (id is null)"
						Set rs= Server.CreateObject("ADODB.Recordset")
						rs.open sql,conn,1,3
						rs.addnew 
						rs("fid")=fid
						rs("filename")=filename3
						rs("fileContentType")=fileContentType3
						rs("filevalue").appendchunk filevalue3
						rs("FileLength")= flength3
						rs.update 
						rs.close 
			end if 
			
			IF  filename4<>"" THEN
						sql="select * from zuoyebuzhiFile where (id is null)"
						Set rs= Server.CreateObject("ADODB.Recordset")
						rs.open sql,conn,1,3
						rs.addnew 
						rs("fid")=fid
						rs("filename")=filename4
						rs("fileContentType")=fileContentType4
						rs("filevalue").appendchunk filevalue4
						rs("FileLength")= flength4
						rs.update 
						rs.close 
			end if 
			
			IF  filename5<>"" THEN
						sql="select * from zuoyebuzhiFile where (id is null)"
						Set rs= Server.CreateObject("ADODB.Recordset")
						rs.open sql,conn,1,3
						rs.addnew 
						rs("fid")=fid
						rs("filename")=filename5
						rs("fileContentType")=fileContentType5
						rs("filevalue").appendchunk filevalue5
						rs("FileLength")= flength5
						rs.update 
						rs.close 
			end if 
		
			rsgonggao.close
			
 






			%>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align="center">



  <table border="1" cellspacing="0" width="700" bordercolorlight="#11B1FF" bordercolordark="#F0F8FF">
    <tr>
      <td width="100%" height="32">
      <p align="center" class="STYLE1 STYLE2">发布成功</td>
    </tr>
    <tr>
      <td width="100%">
        <p align="center"><br>
          <span class="STYLE1 STYLE2">
          <%response.write title%>
          </span> <span class="STYLE3">已经成功发布！！</span></p>
        <p align="left"><span class="STYLE1 STYLE2"><br>
          <br>
         附件为：   <br>
          <br>
          <%response.write filename1%>
          <br>
          <%response.write filename2%>
          <br>
          <%response.write filename3%>
          <br>
          <%response.write filename4%>
          <br>
          <%response.write filename5%>
          <br>
          
    <center>
    <form name="form1" method="post" action="">
      <label>
	
        <div align="center" class="STYLE1">
		<input name="button" type="button" class="topanniu" onClick="location='setpMyClass.asp?fid=<%=fid%>'"  value="设置接受作业班别" />
        </div>
        </label>
      <div align="center"></div>
    </form>
    <p align="center"><br>
    <br>
    </p>      </td>
    </tr>
  </table>
</div>
<%end if
end if
%>
</body>  
  
</html>  



