RichHamilton
09/14/2023, 8:52 AMSebastiaan
09/14/2023, 8:56 AMumbraco\Data
is where we put our stuff these daysSebastiaan
09/14/2023, 8:56 AMAnders Bjerner
09/14/2023, 9:12 AMcsharp
@using Microsoft.AspNetCore.Hosting
@using Umbraco.Cms.Core.Extensions
@using Umbraco.Cms.Core
@inject IWebHostEnvironment WebHostEnvironment
@{
<h3>Data Directory</h3>
<pre>@AppDomain.CurrentDomain.GetData("DataDirectory")</pre>
<pre>@WebHostEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data)</pre>
<h3>TEMP Directory</h3>
<pre>@WebHostEnvironment.MapPathContentRoot(Constants.SystemDirectories.TempData)</pre>
}
Umbraco sets the value for @AppDomain.CurrentDomain.GetData("DataDirectory")
, so you can use that for getting the data directory - or use Umbraco's constant.Anders Bjerner
09/14/2023, 9:15 AMConstants.SystemDirectories.Data
is ~/umbraco/Data
as suggested by Sebastiaan
Constants.SystemDirectories.TempData
is ~/umbraco/Data/TEMP
Sebastiaan
09/14/2023, 9:17 AM.gitignore
file by the way, so if you need to store data that should move accross environments you probably want to make your own directory for it.Sebastiaan
09/14/2023, 9:19 AMKevin Jump
09/14/2023, 10:34 AMKevin Jump
09/14/2023, 10:35 AMcs
_tempPath = Path.GetFullPath(
Path.Combine(hostingEnvironment.LocalTempPath, "my-folder"));
Kevin Jump
09/14/2023, 10:35 AMKevin Jump
09/14/2023, 10:36 AMMapPathContentRoot
might do it 🤷♀️ - but i am not actually sure.Anders Bjerner
09/14/2023, 10:50 AMMapPathContentRoot
will be incorrect