Monday, June 25, 2018

DELETE UPLOADED FILES IN ASP.NET MVC

 @Html.ActionLink("Remove", "DeleteFile", "Home",
                     new { EId = Model.UploadedId, e = Model.FileExtension },
                     new { @class = "deleteFilet", @title = "Remove" })


 [HttpPost]       
 public JsonResult DeleteFile(int EId, string e)
 {
            var filepath = Path.Combine(_uploadFilesPathTemp, EId + e);
            if (System.IO.File.Exists(filepath))
                System.IO.File.Delete(filepath);
            return Json(true);
 }

No comments:

Post a Comment

javascript Filter/index off

 var family = [{"name":"Jack",  "age": 26},               {"name":"Jill",  "age"...