ASP.NET MVC 图片上传(最基本的例子)

    CSDN广告是越来越多了,所有博客笔记不再更新,新网址 DotNet笔记

html代码:

    


处理程序:

 public class HomeController : Controller
    {

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult UploadImg()
        {
            if (Request.Files.Count > 0)
            {
                HttpPostedFileBase f =Request.Files["file1"];
                f.SaveAs(@"D:\" + f.FileName);
            }
            return View();
        }

    }


你可能感兴趣的:(Asp.net)