51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
|
|
<%@ WebHandler Language="C#" Class="imageUp" %>
|
|||
|
|
<%@ Assembly Src="Uploader.cs" %>
|
|||
|
|
|
|||
|
|
using System;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Collections;
|
|||
|
|
|
|||
|
|
public class imageUp : IHttpHandler
|
|||
|
|
{
|
|||
|
|
public void ProcessRequest(HttpContext context)
|
|||
|
|
{
|
|||
|
|
context.Response.ContentType = "text/plain";
|
|||
|
|
|
|||
|
|
//<2F>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
int size = 2; //<2F>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>,<2C><>λMB //<2F>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>λMB
|
|||
|
|
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();
|
|||
|
|
|
|||
|
|
string pathbase = null;
|
|||
|
|
int path=Convert.ToInt32( up.getOtherInfo(context, "dir"));
|
|||
|
|
if (path == 1)
|
|||
|
|
{
|
|||
|
|
pathbase = "upload/" ;
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
pathbase = "upload1/";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
info = up.upFile(context, pathbase, filetype, size); //<2F><>ȡ<EFBFBD>ϴ<EFBFBD>״̬
|
|||
|
|
|
|||
|
|
string title = up.getOtherInfo(context, "pictitle"); //<2F><>ȡͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>
|
|||
|
|
string oriName = up.getOtherInfo(context, "fileName"); //<2F><>ȡԭʼ<D4AD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
HttpContext.Current.Response.Write("{'url':'" + info["url"] + "','title':'" + title + "','original':'" + oriName + "','state':'" + info["state"] + "'}"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>json<6F><6E><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool IsReusable
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|