
<!--#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 topmargin="5" leftmargin="5">
<p>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" Then
'---------------------------
'response.write "开始发送<br>"
'---------------------------
Dim Fields
UploadSizeLimit=31212121
Set Fields = GetUpload()
dim Field
For Each Field In Fields.Items
if Field.name="laiwendanwei" then laiwendanwei=BinaryToString(Field.value)
if Field.name="laiwenbianhao" then laiwenbianhao=BinaryToString(Field.value)
if Field.name="laiweiriqi" then laiweiriqi=BinaryToString(Field.value)


if Field.name="title" then title=BinaryToString(Field.value)

if Field.name="xiaoneibianhao" then xiaoneibianhao=BinaryToString(Field.value)
if Field.name="faburen" then faburen=BinaryToString(Field.value)
if Field.name="faburiqi" then faburiqi=BinaryToString(Field.value)

if Field.name="content" then content=BinaryToString(Field.value)
          
		    




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

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

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

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

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



next

if flength1>CINT(request.cookies("filelength"))  or flength2>CINT(request.cookies("filelength")) or flength3>CINT(request.cookies("filelength")) or flength4>CINT(request.cookies("filelength")) or flength5>CINT(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") ="gonggaoid"
			   .execute
			   fid = .parameters("@id")
			end with

             


			if title="" then          '防止发送无标题文件
			else
			set rsgonggao=server.createobject("adodb.recordset")
			rsgonggaosql="select * from GongWen where (id is null)" 
			
			rsgonggao.open rsgonggaosql,conn,1,3
			rsgonggao.addnew
			
			rsgonggao("id")=fid
			
            rsgonggao("来文单位")=laiwendanwei
			rsgonggao("来文编号")=laiwenbianhao
			rsgonggao("来文日期")=laiweiriqi
			
			rsgonggao("编号")=xiaoneibianhao
			rsgonggao("发布人")=faburen
			rsgonggao("发布日期")=faburiqi
			
			rsgonggao("标题")=title
			rsgonggao("内容")=content

            rsgonggao("是否签署")="否"
			rsgonggao("是否转发")="否"
			rsgonggao("签署领导")=""
			end if 
			
 
			rsgonggao("upDatetime")="0"
		    rsgonggao("upname")=request.cookies("tname")
			strip=Request.ServerVariables("REMOTE_ADDR")
			rsgonggao("IP")=strip
			rsgonggao.update
			
			
			
			
			
			IF  filename1<>"" THEN
						sql="select * from GongWenFile 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 GongWenFile 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 GongWenFile 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 GongWenFile 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 GongWenFile 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='addfile.asp'"  value="继续发布" />
		&nbsp;</div>
      </label>
      
    </form>
    <p align="center"><br>
    <br>
    </p>      </td>
    </tr>
  </table>
</div>
<%end if
end if
%>
</body>  
  
</html>  



