BLOB Storing File System Provider
Use the ABP CLI to add Volo.Abp.BlobStoring.FileSystem NuGet package to your project:
- Open a command line (terminal) in the directory of the file you want to add the
Volo.Abp.BlobStoring.FileSystem
package. - Run
abp add-package Volo.Abp.BlobStoring.FileSystem
command.
Configuration is done in the ConfigureServices
method of your class, as explained in the BLOB Storing document.
Example: Configure to use the File System storage provider by default
See the to learn how to configure this provider for a specific container.
- BasePath (string): The base folder path to store BLOBs. It is required to set this option.
- AppendContainerNameToBasePath (bool; default:
true
): Indicates whether to create a folder with the container name inside the base folder. If you store multiple containers in the same , leave this astrue
. Otherwise, you can set it tofalse
if you don’t like an unnecessarily deeper folder hierarchy.
File System Provider organizes BLOB files inside folders and implements some conventions. The full path of a BLOB file is determined by the following rules by default:
- It starts with the
BasePath
configured as shown above. - Appends
tenants/<tenant-id>
folder if current tenant is not . - Appends the container’s name if
AppendContainerNameToBasePath
istrue
. If container name contains/
, this will result with nested folders. - Appends the BLOB name. If the BLOB name contains
/
it creates folders. If the BLOB name contains.
it will have a file extension.
The service is used to calculate the file paths. Default implementation is the
DefaultBlobFilePathCalculator
. You can replace/override it if you want to customize the file path calculation.