Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Uploads folder in wwwroot doesn't have access to delete a file by the app

$
0
0

I have an Uploads folder in an App Service and uploading is successful.

However, when the app tries to delete the uploaded files, it encounters the error:

System.IO.IOException: Invalid access to memory location. : 'C:\home\site\wwwroot\wwwroot\sample\uploads\MyFile.txt'

I see the structure to be: myapp.scm.azurewebsites.net/dev/wwwroot/wwwroot/sample/uploads/MyFile.txt

private readonly string myUploadFolderPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", configuration["mySettings:UploadsFolderPath"]);public bool RemoveUploadedFiles() {    if (Directory.Exists(myUploadFolderPath)) {        string[] files = Directory.GetFiles(myUploadFolderPath);        foreach (string file in files) {            File.Delete(file);        }           return true;    }    return false;}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>