HTML:


.UploadHandler.ashx

public class UploadHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset = "utf-8";
            string student_id = CommonClass.Request.GetRequest<string>("student_id", "");
            HttpPostedFile file = context.Request.Files["Filedata"];
            string uploadPath =
                HttpContext.Current.Server.MapPath(@context.Request["folder"]) + "\\";

            if (file != null)
            {
                if (!Directory.Exists(uploadPath))
                {
                    Directory.CreateDirectory(uploadPath);
                }
                file.SaveAs(uploadPath + file.FileName);
                //以下这句代码缺少的话,上传成功后上传队列的显示不会自己主动消失
                context.Response.Write("1");
            }
            else
            {
                context.Response.Write("0");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }


相关文章:

  • 2022-12-23
  • 2021-10-03
  • 2021-12-25
  • 2022-12-23
  • 2021-08-20
  • 2021-12-04
  • 2021-11-26
  • 2021-08-06
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案