I am using the FileManagement module to store files in Aws S3 using the AwsBlobProvider.
We need to set the correct Content Type (Mime Type) on Aws when the files are stored. The correct content type is stored in the local DB and looking at the code there is a MimeType property on the FileDescriptor object passed to the IFileDescriptorRepository.InsertAsync() method. I've created my own AwsBlobProvider that can accept ContentType but how do I intercept the IFileDescriptorRepository.InsertAsync() to insert the MimeType?
Thanks, Dean
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
I'm trying to get the FIleManagement module to use the AWS Blob provider but it always seems to use the Database provider. This is what I've done.
The FileManagement module still uses the Database provider. I've tried putting the AWS configuration code in the Domain, Application & EntityFramework and HttpApi modules but none seems to work.
Below is the code I have been trying (AWS credentials not shown) from the Domain module.
Thank's in advance for your help!
Dean
<br>
namespace FMTest
{
[DependsOn(
typeof(FMTestDomainSharedModule),
typeof(AbpAuditLoggingDomainModule),
typeof(AbpBackgroundJobsDomainModule),
typeof(AbpFeatureManagementDomainModule),
typeof(AbpIdentityDomainModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpIdentityServerDomainModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpSettingManagementDomainModule),
typeof(SaasDomainModule),
typeof(TextTemplateManagementDomainModule),
typeof(LeptonThemeManagementDomainModule),
typeof(LanguageManagementDomainModule),
typeof(VoloAbpCommercialSuiteTemplatesModule),
typeof(AbpEmailingModule),
typeof(BlobStoringDatabaseDomainModule)
)]
[DependsOn(typeof(FileManagementDomainModule))]
[DependsOn(typeof(AbpBlobStoringAwsModule))]
public class FMTestDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English", "gb"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe", "tr"));
options.Languages.Add(new LanguageInfo("sl", "sl", "Slovenščina", "si"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文", "cn"));
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsche", "de"));
options.Languages.Add(new LanguageInfo("es", "es", "Español", "es"));
});
ConfigureAWSBlobStoring();
#if DEBUG
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
#endif
}
private void ConfigureAWSBlobStoring()
{
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.Configure<FileManagementContainer>(container =>
{
container.UseAws(Aws =>
{
Aws.AccessKeyId = "your Aws access key id";
Aws.SecretAccessKey = "your Aws access key secret";
Aws.UseCredentials = false;//"set true to use credentials";
Aws.UseTemporaryCredentials = false;// "set true to use temporary credentials";
Aws.UseTemporaryFederatedCredentials = false;// "set true to use temporary federated credentials";
Aws.ProfileName = "the name of the profile to get credentials from";
Aws.ProfilesLocation = "the path to the aws credentials file to look at";
Aws.Region = "the system name of the service";
Aws.Name = "the name of the federated user";
Aws.Policy = "policy";
Aws.DurationSeconds = 100000;// "expiration date";
Aws.ContainerName = "your Aws container name";
Aws.CreateContainerIfNotExists = false;
});
});
});
}
}
}