<!--#include file="../../../Conn.asp"-->
<!--#include file="../../../fy_inc/fy.Main.asp"-->
<!--#include file="../../../fy_inc/UpLoadClass.asp"-->
  <% 	
	Dim fycms
	Set fycms = New ACT_Main
	Public Function UserLoginChecked()
	on error resume next
	Dim AdminName,PassWord
		UserLoginChecked = false 
   		AdminName = RSQL(fycms.toasc(fycms.s("fyuser")))
		PassWord= RSQL(fycms.toasc(fycms.s("fypass")))
		IF AdminName="" Or PassWord = "" Then
		   UserLoginChecked=false
		   Exit Function
		Else
			Dim UserRs
 			Set Userrs=fycms.Actexe("Select Admin_Name,PassWord From Admin_fy Where Admin_Name='" & AdminName & "' And PassWord='" & PassWord & "'")
			IF UserRS.Eof And UserRS.Bof Then
				UserLoginChecked=false
			Else
				UserLoginChecked = true
			End if
			UserRS.Close:Set UserRS=Nothing
	   End IF
	End Function 
	IF Cbool(UserLoginChecked)=false Then
	 ' echo "error"
	'  Response.end
	End If
 Dim ModeID,Yname,instrs,myid,fp,ih,filetype
 Yname=request("Yname")
  myid=Request("act")
 ih=Request("ih")
 filetype=Request("filetype")
 If ih="" Then ih="fycms"
ModeID = ChkNumeric(Request("ModeID"))
If  ModeID=0 or ModeID="" Then ModeID=1
 IF myid="editor" Then
	If ModeID="999" Then fp=fycms.ActSys&"UpFiles/UserFile/Other/" Else fp=fycms.ActSys&fycms.ACT_C(ModeID,8)&year(now) & "/" & month(now)& "/" & Day(now)&"/"
 	Call fycms.CreateFolder(fp)
	Dim UpFile,FileTitles
	set UpFile = New UpLoadClass
  	UpFile.AutoSave = 2
	UpFile.MaxSize =  fycms.fycms_Sys(10)* 1024
	UpFile.FileType = fycms.fycms_Sys(11)
	UpFile.Charset="UTF-8"
	UpFile.SavePath = fp
	UpFile.Open() '# 打开对象
 	If UpFile.Save("upfile",0) Then
		If filetype="1" Then 
			FileTitles=UpFile.Form("pictitle")
  			 	If Instr(FileTitles,"?")<>0 Then 
				 	FileTitles=(left(FileTitles,len(FileTitles)-6))
				Else 
 				 	FileTitles=(left(FileTitles,len(FileTitles)-4))
				End If 
			If  Trim(FileTitles)<>"" Then FileTitles=unescape(FileTitles) '防止中文乱码
			echo "{""url"":"""&fycms.PathDoMain&fp&UpFile.Form("upfile")&""",""title"":"""&FileTitles&""",""state"":""SUCCESS""}"
		ElseIf filetype="3" Then 
 			 echo "{'state':'SUCCESS','url':'"&fycms.PathDoMain&fp&UpFile.Form("upfile")&"','fileType':'"&UpFile.Form("upfile_Ext")&"','title':'"&UpFile.Form("upfile_Name")&"','original':'"&UpFile.Form("upfile_Name")&"'}"
		Else
			echo "{""url"":"""&fycms.PathDoMain&fp&UpFile.Form("upfile")&""",""original"":"""&UpFile.Form("upfile")&""",""state"":""SUCCESS"",""fileType"":""."&UpFile.Form("upfile_Ext")&"""}"
		End If 
 	End If
 	Set UpFile = Nothing
End If 


 %>
 