I'm getting System.UnauthorizedAccessException when trying to create a file using
using (var fileStream = System.IO.File.Create(filePath))
this is only trace i got
Exception thrown: 'System.UnauthorizedAccessException' in System.Private.CoreLib.dll
It's ASP.NET Core 6 Web API run on docker
Any Ideas? Thanks :)
EDIT: Here is mu complete malfunctioning code snippet:
var filePath = Path.Combine(_environment.WebRootPath, "Uploads");
if(!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
using (var fileStream = System.IO.File.Create(filePath))
await file.CopyToAsync(fileStream);