public ActionResult UploadFile(HttpPostedFileBase uploadedFile, VideosDO video, Int64 munitionID) { ActionResult oResponse = RedirectToAction("Index", "Videos", new { munitionID }); if (ModelState.IsValid) { try { if (uploadedFile != null /* && uploadedFile.ContentType == ".mp4"*/) { string pathToSaveTo = Path.Combine(Server.MapPath("/Files/"), uploadedFile.FileName); pathToSaveTo = pathToSaveTo.Replace("\"", "/").Replace("\\", "//"); uploadedFile.SaveAs(pathToSaveTo); video.UserID = (Int64)Session["UserID"]; video.VideoPath = "~/Files/" + uploadedFile.FileName; } dataAccess.UploadVideo(video); } catch (Exception ex) { } } return(oResponse); }