<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/UpLoadClass.asp"-->
<!--#include file="../../fy_inc/CreateView.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>上传文件</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
 <style type="text/css">
<!--
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,   
form,fieldset,input,textarea,p,blockquote,th,td {padding:0; margin:0;}
html, body { height:100%;} /* 同时设置html是为了兼容FF */
body { font-size: 12px; color: black; line-height: 150%; background-color:#fff; text-align: center; height:100%; width:98%;}
.table_list, .table_form, .table_info { margin:0 auto; width:99%; *margin-top:6px; background:#D5EDFD; border:1px solid #99d3fb;}
.table_list caption, .table_form caption, .table_info caption{ border:1px solid #99d3fb; border-bottom-width:0; font-weight:bold; color:#077ac7;  height:27px; line-height:27px; margin:6px auto 0;font-size:12px; font-family:"宋体"}
h4 { border:1px solid #069; border-width:0 1px 1px 0; margin-top:0; font-size:14px; text-align:left;  height:28px; line-height:28px; color:#fff;position:absolute; top:0; bottom:0; left:0; z-index:500; width:219px;}
h4 span{  padding-left:30px;}
h4 img{ cursor:pointer;}
.table_form, .table_info {}
.table_form tr,.table_info tr,.table_list tr{ background-color:#fff;}
.table_form td, .table_form th, .table_info td,.table_list td  { line-height:150%; padding:4px;font-size:12px; font-family:"宋体";}
.table_form th strong, .table_info th strong { color:#077ac7;}
-->
</style>

<script type="text/javascript">
	var api = frameElement.api, W = api.opener;
</script>





</head>
<body>
 <script>
function addUploadItem(type,instrname,valuea){
 parent.document.getElementById(instrname).value=valuea;
  
}
</script> <%
' response.end
    Dim ModeID,instrname,instrs
    ModeID = ChkNumeric(Request("ModeID"))
    If  ModeID=0 or ModeID="" Then ModeID=1
    If Request("t")="1" Then
	Upfile_Main()
	Else
 		Main()
	End If
    Sub Upfile_Main()
	'-----------------------------------------------------------------------------
	'提交验证
	'-----------------------------------------------------------------------------
  	Dim Upload,FilePath,FormName,File,F_FileName,fs,instrs,myid,fp,TempFileName,fileext
 	If modeid > 100 Then 
		Select Case ModeID
				Case "888"'栏目
					fp="UpFiles/Class/"&year(now) & "/" & month(now)& "/" & Day(now)&"/"
				Case "777"'用户
					fp="UpFiles/UserFile/"&year(now) & "/" & month(now)& "/" & Day(now)&"/"
				Case "666"'广告图片
					fp="UpFiles/ad/"&year(now) & "/" & month(now)& "/" & Day(now)&"/"
				Case Else 
					fp="UpFiles/other/"&year(now) & "/" & month(now)& "/" & Day(now)&"/"
		End Select 
	Else 
		fp=fycms.ACT_C(ModeID,8)&year(now) & "/" & month(now)& "/" & Day(now)&"/"
	End If 
	Call fycms.CreateFolder(fycms.ActSys&fp)
	FilePath = fycms.ActSys&fp
	 instrname=request("instrname")
	 instrs=ChkNumeric(request("instr"))
	Dim UpFile
	set UpFile = New UpLoadClass
  	UpFile.AutoSave = 2
	UpFile.MaxSize =  fycms.fycms_Sys(10)* 1024
	UpFile.FileType = fycms.fycms_Sys(11)
	UpFile.SavePath = fycms.ActSys&fp
	UpFile.Open() '# 打开对象
 	If UpFile.Save("Filedata",0) Then
 		F_FileName=fycms.ActSys&fp&UpFile.Form("Filedata")
 		fileext= LCase(UpFile.Form("Filedata_Ext"))
		echo "<script>W.document.getElementById('"&instrname&"').value ="""&F_FileName&""";api.close();</script>"

      Else
		Select Case UpFile.Form("Filedata_Err")
		Case -1 : echo "<a href='Upload_Admin.Asp?ModeID="&ModeID&"&instrname="&instrname&"&instr="&instrs&"'>没有文件上传，请返回重新上传</a>"
		Case 1 : echo "文件大小超出限制，请返回重新上传"
		Case 2 : echo "不允许上传的文件类型，请返回重新上传"
		Case 3 : echo "文件大小超出限制并且是不允许上传的文件类型，请返回重新上传</div>"
		Case Else : echo "未知错误，请返回重新上传</div>"
		End Select
 	End If
	Set UpFile = Nothing
  End Sub
   
  
  Sub main()
  %>

<form name="upload" method="post" action="?t=1&ModeID=<%= Request("ModeID") %>&instrname=<%=Request("instrname")%>&instr=<%=Request("instr")%>"  enctype="multipart/form-data"  >
 <table cellpadding="2" cellspacing="1" class="table_form">
    <caption>文件上传</caption>
  <tr><td>
              <input name="Filedata" type="file" size="15"  class="btn" >
             <input type="submit" name="dosubmit" value=" 上传 " class="btn btn_primary">
             		 </td>
   </tr>
  <tr>
     <td>
 	 </td>
   </tr>
</table>
</form>
 
<%End Sub %>
</body>
</html>