diff --git a/COMETwebapp/ViewModels/Components/EngineeringModel/FileStore/FileRevisionHandler/FileRevisionHandlerViewModel.cs b/COMETwebapp/ViewModels/Components/EngineeringModel/FileStore/FileRevisionHandler/FileRevisionHandlerViewModel.cs index 04eafd7b..0019b3a7 100644 --- a/COMETwebapp/ViewModels/Components/EngineeringModel/FileStore/FileRevisionHandler/FileRevisionHandlerViewModel.cs +++ b/COMETwebapp/ViewModels/Components/EngineeringModel/FileStore/FileRevisionHandler/FileRevisionHandlerViewModel.cs @@ -127,11 +127,6 @@ public void InitializeViewModel(File file, FileStore fileStore) this.FileTypes = this.SessionService.GetSiteDirectory().AvailableReferenceDataLibraries().SelectMany(x => x.FileType); this.ErrorMessage = string.Empty; this.UploadsDirectory = Path.Combine("wwwroot", "uploads", Guid.NewGuid().ToString()); - - if (!Directory.Exists(this.UploadsDirectory)) - { - Directory.CreateDirectory(this.UploadsDirectory); - } } /// @@ -173,6 +168,11 @@ public async Task UploadFile(IBrowserFile file) return; } + if (!Directory.Exists(this.UploadsDirectory)) + { + Directory.CreateDirectory(this.UploadsDirectory); + } + var uploadedFilePath = Path.Combine(this.UploadsDirectory, Guid.NewGuid().ToString()); await using (var fileStream = new FileStream(uploadedFilePath, FileMode.Create))