Reputation: 1
my script
$("#btnDelete").click(function () {
$.post(url, { fileName: _fileNameAttachementPhoto }, function (data) {
$("#ResumePart4").html(data);
});
});
my controllers
[HttpPost]
public ActionResult DeleteConfirmed(string fileName)
{
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
FileInfo file = new FileInfo(path);
if (file.Exists) {
file.Delete();
}
return RedirectToAction("DeleteConfirmed");
}
I tried do this but nothing happened.
Upvotes: 0
Views: 1861
Reputation: 15387
Try this
$.post('@Url.Action("DeleteConfirmed", "ControllerName")',
{
fileName: FileName
});
Upvotes: 3