Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Upload File to the path out of webroot

$
0
0

With the asp.net core , I can upload a file to the  wwwroot path , but how can I upload file to the path out of  wwwroot , e.g. “D:/MyPath”,

My  code, like  this :  

var filePath = @"D:\mydata";

using (Stream outputStream = new FileStream(filePath, fileMode)){//do sth}

when I run it , I get the error as :

UnauthorizedAccessException: Access to the path 'D:\mydata' is denied.

System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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