Beispiel #1
0
        public bool Comprobar_SiEsImagen(HttpPostedFileBase file)
        {
            if (file.Equals(null))
            {
                return(false);
            }

            if (file.ContentType.Contains("image"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public ActionResult StaffPortal(HttpPostedFileBase file)
        {
            List <Project> pro = db.Projects.ToList();

            if (!file.Equals(null))
            {
                try
                {
                    string path = Path.Combine(Server.MapPath("~/Files/Excel Files"),
                                               Path.GetFileName(file.FileName));
                    file.SaveAs(path);
                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }
            }
            else
            {
                ViewBag.Message = "You have not specified a file.";
            }
            return(View(pro));
        }