Hello,
I upload documents to the server using the RadzenUpload Component. The files are saved in wwwroot and the path to the document is saved in DB.
Now I want to delete the files too, but I can't get it to work.
I extend the DocumentsController to OnAfterCtDocumentDeleted in a CustomController:
partial void OnAfterCtDocumentDeleted (Models.Idlinkeddata.CtDocument item) {
if (System.IO.File.Exists (item.Document))
{
System.IO.File.Delete (item.Document);
}
-> the Method is called in public IActionResult DeleteCtDocument(int key), but does nothing
I also tried implementing the method in the XXX.razor.cs(client, not server) file as a custom method that I can invoke in radzen on ButtonClickEvent:
private void DeleteFile (string filePath)
{
if (System.IO.File.Exists (filePath))
{
System.IO.File.Delete (filePath);
}
}
-> but the method is not called.
Do you have any idea why it's not working? Is there any other way to delete files?
Thank you!