<!--#include file="../fy_inc/fy.User.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 href="images/css.css" rel="stylesheet" type="text/css" />
</head>
 <script>
function addUploadItem(type,instrname,valuea){
 parent.document.getElementById(instrname).value=valuea;
  
}
</script><body>
  <%
     dim UserHS ,A
 	Set UserHS = New ACT_User
	IF Cbool(UserHS.UserLoginChecked)=false then
	  echo "<script>top.location.href ='login.asp' ;</script>"
	  Response.end
	End If	

  Dim ModeID,instrname,instrs
 instrname=request("instrname")
 instrs=ChkNumeric(request("instr"))
  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,Thumb_FileName,fileext
	If ModeID="999" Then fp="UpFiles/UserFile/Other/" Else fp=fycms.ACT_C(ModeID,8)&year(now) & "/" & month(now)& "/" & Day(now)&"/"
	Call fycms.CreateFolder(fycms.ActSys&fp)
	FilePath = fycms.ActSys&fp
  	Dim UpFile
	set UpFile = New UpLoadClass
  	UpFile.AutoSave = 2
 	UpFile.MaxSize =  UserHS.G_UpfilesSize* 1024
	UpFile.FileType = UserHS.G_UpFileType
	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>addUploadItem('"&fileext&"','"&instrname&"','"&F_FileName&"')</script><div style=""padding:6px""><a href='Upload_Admin.Asp?ModeID="&ModeID&"&instrname="&instrname&"&instr="&instrs&"'>文件上传成功，请返回继续上传</a></div>"


  
    Else
		Select Case UpFile.Form("Filedata_Err")
		Case -1 : echo "没有文件上传，请返回重新上传"
		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">
 
              <input name="Filedata" type="file" size="15">
 
             <input type="submit" name="dosubmit" class="button_style" value=" 上传 ">
    
</form>
<%End Sub %>
</body>
</html>