| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <%@ WebHandler Language="C#" Class="UEditorHandler" %>
- using System;
- using System.Web;
- using System.IO;
- using System.Collections;
- using Newtonsoft.Json;
- public class UEditorHandler : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- Handler action = null;
- switch (context.Request["action"])
- {
- case "config":
- action = new ConfigHandler(context);
- break;
- case "uploadimage":
- action = new UploadHandler(context, new UploadConfig()
- {
- AllowExtensions = Config.GetStringList("imageAllowFiles"),
- PathFormat = Config.GetString("imagePathFormat"),
- SizeLimit = Config.GetInt("imageMaxSize"),
- UploadFieldName = Config.GetString("imageFieldName"),
- PhysicalPath = Config.GetString("imagePhysicalPath")
- });
- break;
- case "uploadscrawl":
- action = new UploadHandler(context, new UploadConfig()
- {
- AllowExtensions = new string[] { ".png" },
- PathFormat = Config.GetString("scrawlPathFormat"),
- SizeLimit = Config.GetInt("scrawlMaxSize"),
- UploadFieldName = Config.GetString("scrawlFieldName"),
- PhysicalPath = Config.GetString("scrawlPhysicalPath"),
- Base64 = true,
- Base64Filename = "scrawl.png"
- });
- break;
- case "uploadvideo":
- action = new UploadHandler(context, new UploadConfig()
- {
- AllowExtensions = Config.GetStringList("videoAllowFiles"),
- PathFormat = Config.GetString("videoPathFormat"),
- PhysicalPath = Config.GetString("videoPhysicalPath"),
- SizeLimit = Config.GetInt("videoMaxSize"),
- UploadFieldName = Config.GetString("videoFieldName")
- });
- break;
- case "uploadfile":
- action = new UploadHandler(context, new UploadConfig()
- {
- AllowExtensions = Config.GetStringList("fileAllowFiles"),
- PathFormat = Config.GetString("filePathFormat"),
- PhysicalPath = Config.GetString("filePhysicalPath"),
- SizeLimit = Config.GetInt("fileMaxSize"),
- UploadFieldName = Config.GetString("fileFieldName")
- });
- break;
- case "listimage":
- action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles"));
- break;
- case "listfile":
- action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles"));
- break;
- case "catchimage":
- action = new CrawlerHandler(context);
- break;
- default:
- action = new NotSupportedHandler(context);
- break;
- }
- action.Process();
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
|