<!--#include file="../../Inc/Cls_Main.Asp"-->
<!--#include file="../inc/Cls_Admin.Asp"-->
<!--#include file="../inc/Cls_UpLoad.Asp"-->
<%
Dim Action
Action = LCase(Easp.Get("action:s"))
Select Case Action
    Case "upfile"
        Call UpFile()
    Case "loadplugins"
        Call GetPlugins()
End Select

Sub GetMenu()

End Sub

Sub UpFile()
    Dim objUpLoad, ChannelId, UpType
    Dim UpLoadExt, UpLoadSize, UpLoadPath
    ChannelId = Easp.Get("ChannelId:n:0")
    UpType = Easp.Get("UpType:n:0")
    Set objUpLoad = New Cls_UpLoad
    objUpLoad.SetChannelId = ChannelId
    objUpLoad.SetUpType = UpType
    objUpLoad.GetUpFileValue()
    UpLoadExt = objUpLoad.GetUpFileExt()
    UpLoadSize = objUpLoad.GetUpFileSize()
    UpLoadPath = objUpLoad.GetUpLoadPath()
    '=========================================== 加载MoLibUpload V1.0 Beta For EasyAasp插件
    Dim Upload, UpFile, Items, UpLoadName, UpLoadFileName, ThumbPath
    Set Upload = Easp.Ext("molibupload")
    Upload.AllowFileTypes = UpLoadExt
    Upload.AllowMaxFileSize = UpLoadSize
    Upload.AllowMaxSize = "50MB"
    If Not Upload.GetData() Then
        ShowEditorMsg 1, Upload.Description(), "", 0
    Else
        Upload.SavePath = UpLoadPath
        For Each Items In Upload.Files("-1")
            Set UpFile = Upload.Save(Items, 0, True)
            If UpFile.Succeed Then
                UpLoadName = UpFile.FileName
                UpLoadFileName = UpLoadPath & UpLoadName
                '============================================================= 处理图片部分开始
                objUpLoad.SetUpFileName = UpLoadFileName
                objUpLoad.CreateUpFile()
                ThumbPath = objUpLoad.UpThumbnailFile()
                ThumbPath = Easp.IIf(Easp.IsN(ThumbPath), UpLoadFileName, ThumbPath)
                '============================================================= 结束
                ShowEditorMsg 0, UpLoadFileName, Replace(UpFile.LocalName, "." & UpFile.Extend, ""), ThumbPath
            Else
                ShowEditorMsg 1, UpFile.Exception, "", 0
            End If
        Next
    End If
    Set objUpLoad = Nothing
    Set Upload = Nothing
End Sub

Sub ShowEditorMsg(EditorMode, ReturnVal, RootName, ThumbVal)
    Easp.Use "json"
    If EditorMode = 0 Then
        Easp.json.addData "error", 0
        Easp.json.addData "url", ReturnVal & ""
        Easp.json.addData "rootname", RootName & ""
        Easp.json.addData "ThumbPic", ThumbVal & ""
    Else
        Easp.json.addData "error", 1
        Easp.json.addData "message", ReturnVal & ""
    End If
    Easp.json.addData "rnd", Easp.RandStr(20)
    Easp.WE Easp.Json.jsString()
End Sub
%>