A Simple Upload API for ASP.NET Core Applications
$ dotnet add package DotNetBrightener.SimpleUploadService© 2025 DotNet Brightener
Run this in command line:
dotnet add package DotNetBrightener.SimpleUploadService
serviceCollection.RegisterSimpleUploadService(builder => {
// configure your upload configuration here
});
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));
}
}
Implement your own logic for resizing photos by deriving the IImageResizer interface. Then you need to register it by
undefined
IUploadServiceProvider