Umbraco Forms contains a built-in Get value from textfile
Prevalue Source Type that stores the uploaded text file into the physical file system (by default in umbraco\Data\UmbracoForms\PreValueTextFiles
).
You can replace the default implementation by writing your own IPreValueTextFileStorage
and registering that using e.g. builder.Services.AddUnique<IPreValueTextFileStorage, CustomPreValueTextFileStorage>()
(in Startup.cs
or a composer).
You can also use/inherit from PreValueTextFileSystemStorage
to change the underlying IFileSystem
that's used to store the prevalue text files.
You can use the following composer to move the prevalue text files into the media file system. If the media file system is using Azure Blob Storage, this will remove the files from the local physical file system.
You need to manually move the existing files from umbraco\Data\UmbracoForms\PreValueTextFiles
to your media storage. The final file path/URL will look like ~/media/PreValueTextFiles/{GUID}/{filename.txt}
and be accessible from the browser.
First, install Umbraco.StorageProviders.AzureBlob and configure the Forms storage container, for example by adding the following to your appsettings.json
:
Next, add the following composer that adds the Forms storage container and stores the prevalue text files into Azure Blob Storage (in forms/PreValueTextFiles/{GUID}/{filename.txt}
):
You need to manually move the existing files from umbraco\Data\UmbracoForms\PreValueTextFiles
to your storage container. If you've disabled public access, the stored files are not accessible from the browser.