public void addSupplyDescImg(HttpContext context) { SupplyImg supplyImg = new SupplyImg(); supplyImg.Supply.Id = Convert.ToInt32(context.Request["Id"]); Dictionary <String, Object> dictionary = new Dictionary <string, object>(); string savepath = ""; Boolean flag = false; if (context.Request.Files.Count > 0) { for (int i = 0; i < context.Request.Files.Count; i++) { HttpPostedFile file1 = context.Request.Files["descImg" + i]; savepath = FileUtil.uploadImg(file1, "../images/"); supplyImg.ImgPath = savepath; supplyImg.ImgStatus = 1; flag = supplyService.addSupplyImg(supplyImg); } } if (flag) { dictionary.Add("success", "true"); } else { dictionary.Add("success", "false"); } context.Response.Write(JsonUtil.toJson(dictionary).ToString()); }