54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
|
|
<%@ WebHandler Language="C#" Class="scrawlImgUp" %>
|
|||
|
|
<%@ Assembly Src="Uploader.cs" %>
|
|||
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Collections;
|
|||
|
|
|
|||
|
|
public class scrawlImgUp : IHttpHandler
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public void ProcessRequest(HttpContext context)
|
|||
|
|
{
|
|||
|
|
context.Response.ContentType = "text/html";
|
|||
|
|
string action = context.Request["action"];
|
|||
|
|
|
|||
|
|
if (action == "tmpImg")
|
|||
|
|
{
|
|||
|
|
//<2F>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
string pathbase = "tmp/"; //<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|||
|
|
int size = 2; //<2F>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>,<2C><>λmb //<2F>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>λKB
|
|||
|
|
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
|
|
|||
|
|
//<2F>ϴ<EFBFBD>ͼƬ
|
|||
|
|
Hashtable info = new Hashtable();
|
|||
|
|
Uploader up = new Uploader();
|
|||
|
|
info = up.upFile(context, pathbase, filetype, size); //<2F><>ȡ<EFBFBD>ϴ<EFBFBD>״̬
|
|||
|
|
|
|||
|
|
HttpContext.Current.Response.Write("<script>parent.ue_callback('" + info["url"] + "','" + info["state"] + "')</script>");//<2F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
string pathbase = "upload/"; //<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|||
|
|
string tmpPath = "tmp/"; //<2F><>ʱͼƬĿ¼
|
|||
|
|
|
|||
|
|
//<2F>ϴ<EFBFBD>ͼƬ
|
|||
|
|
Hashtable info = new Hashtable();
|
|||
|
|
Uploader up = new Uploader();
|
|||
|
|
info = up.upScrawl(context, pathbase, tmpPath, context.Request["content"]); //<2F><>ȡ<EFBFBD>ϴ<EFBFBD>״̬
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>json<6F><6E><EFBFBD><EFBFBD>
|
|||
|
|
HttpContext.Current.Response.Write("{'url':'" + info["url"] + "',state:'" + info["state"] + "'}");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool IsReusable
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|