zeenTo 2015-08-04 05:08 采纳率: 0%
浏览 1474

谁帮我改改下面的代码

将下面的一般处理程序改为控制器代码

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;
        }
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 beats蓝牙耳机怎么查看日志
    • ¥15 Fluent齿轮搅油
    • ¥15 八爪鱼爬数据为什么自己停了
    • ¥15 交替优化波束形成和ris反射角使保密速率最大化
    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏