DotNetBrightener.SimpleUploadService
2022.11.1
See the version list below for details.
dotnet add package DotNetBrightener.SimpleUploadService --version 2022.11.1
NuGet\Install-Package DotNetBrightener.SimpleUploadService -Version 2022.11.1
<PackageReference Include="DotNetBrightener.SimpleUploadService" Version="2022.11.1" />
paket add DotNetBrightener.SimpleUploadService --version 2022.11.1
#r "nuget: DotNetBrightener.SimpleUploadService, 2022.11.1"
// Install DotNetBrightener.SimpleUploadService as a Cake Addin #addin nuget:?package=DotNetBrightener.SimpleUploadService&version=2022.11.1 // Install DotNetBrightener.SimpleUploadService as a Cake Tool #tool nuget:?package=DotNetBrightener.SimpleUploadService&version=2022.11.1
Simple Upload API for ASP.NET Application
© 2022 DotNet Brightener
Installation
Run this in command line:
dotnet add package DotNetBrightener.SimpleUploadService
Or add the following to .csproj
file
<PackageReference Include="DotNetBrightener.SimpleUploadService" Version="2022.10.0" />
Usage
1. Register the service
serviceCollection.RegisterSimpleUploadService(builder => {
// configure your upload configuration here
});
2. Upload Path
Default upload folder is {environment.ContentRootPath}/Media
. For example, if you deploy the application in /app
of the computer, the upload folder will be /app/Media
.
You can replace the default upload folder by implementing IUploadFolderPathResolver
interface and provide your own logic of determining where to store the uploaded file.
public class TenantBasedUploadPathResolver : IUploadFolderResolver
{
public string UploadRootPath { get; }
public TenantBasedUploadPathResolver(IHostEnvironment hostEnvironment)
{
this.UploadRootPath = hostEnvironment.ContentRootPath;
}
public Task<string> ResolveUploadPath(string uploadPath)
{
return Task.FromResult(uploadPath.Replace('/', Path.DirectorySeparatorChar)
.Replace('\\', Path.DirectorySeparatorChar));
}
}
Resizing image when upload
Implement your own logic for resizing photos by deriving the IImageResizer
interface. Then you need to register it by
Extend API with IUploadServiceProvider
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- DotNetBrightener.Plugins.EventPubSub (>= 2022.10.0)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DotNetBrightener.SimpleUploadService:
Package | Downloads |
---|---|
DotNetBrightener.UploadService.AzureBlobStorage
Azure Blob Storage Upload API for ASP.NET Core Applications |
|
DotNetBrightener.UploadService.ImageOptimizer
An Image Resizer used with DotNetBrightener.SimpleUploadService package |
GitHub repositories
This package is not used by any popular GitHub repositories.