阅读背景:

web文件上传,webapi后台接收

来源:互联网 

后台:

        public string Post()
        {
            string key = HttpContext.Current.Request["key"];
            string value = HttpContext.Current.Request["value"];
            HttpFileCollection files = HttpContext.Current.Request.Files;

            foreach (string f in files.AllKeys)
            {
                HttpPostedFile file = files[f];
                if (string.IsNullOrEmpty(file.FileName) == false)
                    file.SaveAs(HttpContext.Current.Server.MapPath("~/App_Data/") + file.FileName);
            }

            return key + value;
        }        public string Post()
        {



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: