<!--#include file="../../Conn.asp"-->
<!--#include file="../../fy_inc/fy.Main.asp"-->
<!--#include file="../../fy_inc/UpLoadClass.asp"-->
<!--#include file="../../fy_inc/CreateView.asp"-->
 <% 	
	Dim fycms,UserID,G_UpFileType,G_UpfilesSize
	Set fycms = New ACT_Main
	Public Function UserLoginChecked()
	on error resume next
	Dim UserName,UserPassword
		UserLoginChecked = false 
		UserName = Rsql(fycms.toasc(fycms.s("fyuser")))
		UserPassword= Rsql(fycms.toasc(fycms.s("fypass")))
		IF UserName="" Or UserPassword = "" Then
		   UserLoginChecked=false
		   Exit Function
		Else
			Dim UserRs
			Set Userrs=fycms.Actexe("Select UserID,UserName,PassWord From User_fy Where UserName='" & UserName & "' And PassWord='" & UserPassword & "'")
			IF UserRS.Eof And UserRS.Bof Then
				UserLoginChecked=false
			Else
				UserLoginChecked = True
				UserID=userrs("UserID")
				GroupID = UserRS("GroupID")
				Dim Rs,GroupArr
				Set Rs=fycms.ACTEXE("Select ModeID,GroupSetting,GroupName from Group_fy  Where GroupID=" & GroupID & " order by GroupID desc")
				If Not Rs.Eof Then
					GroupArr=Split(Rs("GroupSetting"),"^@$@^")
					G_UpFileType=GroupArr(10)
					G_UpfilesSize=GroupArr(9)
				End If
 			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
	 fp=fycms.ActSys&"UpFiles/UserFile/"&UserID&"/Other/"
	
  	Call fycms.CreateFolder(fp)
	Dim UpFile,FileTitles
	set UpFile = New UpLoadClass
  	UpFile.AutoSave = 2
 	UpFile.MaxSize =  G_UpfilesSize* 1024
	UpFile.FileType = G_UpFileType
	UpFile.SavePath = fp
	UpFile.Open() '# 打开对象
 	If UpFile.Save("upfile",0) Then
 		Dim W:Set W = New CreateView
		'Call  W.SY(fycms.ActSys&fp&UpFile.Form("Filedata"),UpFile.Form("Filedata_Ext"))
	'	Call OutUploadScript(UpFile.Form("upfile_Ext"),fycms.PathDoMain&fp&UpFile.Form("Filedata"),Yname)
        'If Not  IsNull(UpFileObj.Form("fileNames")) Then FileTitles=unescape(UpFileObj.Form("fileNames")) '防止中文乱码
		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_Name")&""",""state"":""SUCCESS"",""fileType"":""."&UpFile.Form("upfile_Ext")&"""}"
		End If 
 	End If
 	Set UpFile = Nothing
End If 


 %>
 