Beispiel #1
0
        public ActionResult Index(int id, string Username, string User_email, string User_contact, HttpPostedFileBase file)
        {
            var path = "";

            if (file != null)
            {
                if (file.ContentLength > 0)
                {
                    if (Path.GetExtension(file.FileName).ToLower() == ".jpg" ||
                        Path.GetExtension(file.FileName).ToLower() == ".png" ||
                        Path.GetExtension(file.FileName).ToLower() == ".gif" ||
                        Path.GetExtension(file.FileName).ToLower() == ".jpeg")
                    {
                        path = Path.Combine(Server.MapPath("~/Content/Images"), file.FileName);
                        file.SaveAs(path);
                    }

                    var filename = file.FileName;

                    var Userprofile = "~/Content/Images/" + filename;

                    db.Profileupdate(id, Username, User_email, User_contact, Userprofile);
                }
            }

            return(RedirectToAction("Index", "Profile"));
        }