Storage Medium

Fanray stores your uploaded images either on the File System or Azure Blob Storage, this can be configured in appsettings.json.

 "AppSettings": {
   // Media file storage, "FileSystem" or "AzureBlob" 
   // "FileSystem": the files uploaded will be stored on the file system 
   // "AzureBlob": the files uploaded will be stored in Azure Blob Storage 
   "MediaStorageType": "FileSystem",
   // File upload folder 
   // For FileSystem, it's a folder created in wwwroot 
   // For AzureBlob, it's a container created in your Azure storage account 
   "MediaContainerName": "media"
 "ConnectionStrings": {
    // Azure Blob Storage connection string
    // When in dev, I recommend using Azure Storage Emulator
    // It's installed as part of the Azure SDK, windows > search "azure storage emulator" to start it,
    // When deploy to Azure, create this key with real connection string in your App Service > App settings > Connection strings
    // section, as this value will be overriden by that one.
    // Tip: you can use Azure Storage Explorer to manage local or remote azure storages
    "BlobStorageConnectionString": "UseDevelopmentStorage=true"

For file System, all files will be saved in the wwwroot > media folder.

I recommend Blob Storage when running on Azure, and you can experiment it locally. The connection string value UseDevelopmentStorage=true is used for local blob storage, it’s a free Microsoft tool you can install Azure Storage Explorer.

File Path and Name

The specific path structure is application specific. For the Blog application, it uses the following convention {app}/{year}/{month}/{sizePath}, for example https://localhost:44381/media/blog/2019/06/md/autumn.jpg.

The file name preserves the original file name, and if there is file name collision a new file name is created by attaching hyphen and a number, see SEO for details.