将下面的一般处理程序改为控制器代码
public class uptupian : IHttpHandler,IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
HttpFileCollection files = context.Request.Files;
yey_oa_dbEntities entity = new yey_oa_dbEntities();
string spname = context.Request["spname"];
string lurudate = context.Request["lurudate"];
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
if (file.ContentLength > 0 && file.ContentLength < 1000 * 1024)
{
//全路径
string FullFullName = file.FileName;
//获取图片的名称
string name = context.Request["cunpath1"];
string[] pa = name.Split('.');
int l = pa.Length;
string p = pa[l - 1];
string timeStamp = DateTime.Now.ToFileTime().ToString();
String fileName = timeStamp + "." + p;
string path = "~/Core/02WeiXinYinXiao/PhotoGuanli/RollPicture/gundongANDlogoIMG";
file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path) + "\\" + fileName);
context.Response.Write(fileName);
}
else
{
context.Response.Write("noup");
}
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}