diff --git a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs index c8df39b49a8c..99c1aa5649a9 100644 --- a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs @@ -25,6 +25,12 @@ public class HostingSettings [DefaultValue(StaticLocalTempStorageLocation)] public LocalTempStorage LocalTempStorageLocation { get; set; } = Enum.Parse(StaticLocalTempStorageLocation); + /// + /// Gets or sets a value for the location of temporary file uploads. + /// + /// /umbraco/Data/TEMP/TemporaryFile if nothing is specified. + public string? TemporaryFileUploadLocation { get; set; } + /// /// Gets or sets a value indicating whether umbraco is running in [debug mode]. /// diff --git a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs index 1dfa72039c79..15a7ef74e31a 100644 --- a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs +++ b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs @@ -43,7 +43,12 @@ public interface IHostingEnvironment string LocalTempPath { get; } /// - /// The web application's hosted path + /// Gets the location of temporary file uploads. + /// + public string TemporaryFileUploadPath => Path.Combine(LocalTempPath, "TemporaryFile"); + + /// + /// The web application's hosted path. /// /// /// In most cases this will return "/" but if the site is hosted in a virtual directory then this will return the diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs index 0190cd2034d3..a369a6e87d3a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs @@ -27,7 +27,7 @@ public LocalFileSystemTemporaryFileRepository( private DirectoryInfo GetRootDirectory() { - var path = Path.Combine(_hostingEnvironment.LocalTempPath, "TemporaryFile"); + var path = _hostingEnvironment.TemporaryFileUploadPath; if (!Directory.Exists(path)) { diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs index 324781b5a3cc..9a57147bcc05 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs @@ -132,6 +132,10 @@ public string LocalTempPath } } + /// + public string TemporaryFileUploadPath => _hostingSettings.CurrentValue.TemporaryFileUploadLocation + ?? Path.Combine(MapPathContentRoot(Core.Constants.SystemDirectories.TempData), "TemporaryFile"); + /// public string MapPathWebRoot(string path) => _webHostEnvironment.MapPathWebRoot(path);