I can't find out what I'm doing wrong because it doesn't throw any errors. I am trying to send the file from IFormFile to minio as below, but when I go into minio I see that the file is not loaded. Minio is installed with default settings as docker-compose with one empty bucket and access keys defined.
BucketExistsAsync returns 'true'. There is no problem with the api key.
Version: .NET 6.0
Minio SDK: 6.0.3
using var fileStream = person.Avatar.OpenReadStream();
try
{
bool found = await _minioClient.BucketExistsAsync(new BucketExistsArgs().WithBucket("my-bucket"));
Aes aesEncryption = Aes.Create();
aesEncryption.KeySize = 256;
aesEncryption.GenerateKey();
var ssec = new SSEC(aesEncryption.Key);
var putObjectArgs = new PutObjectArgs()
.WithBucket("my-bucket")
.WithObject("/businesses/" + businessId + "/people/" + person.Avatar.FileName)
.WithStreamData(fileStream)
.WithObjectSize(person.Avatar.Length)
.WithContentType("application/octet-stream");
var response = await _minioClient.PutObjectAsync(putObjectArgs);
Console.WriteLine("uploaded successfully");
StatObjectArgs statObjectArgs = new StatObjectArgs()
.WithBucket("my-bucket")
.WithObject("/businesses/" + businessId + "/people/" + person.Avatar.FileName);
ObjectStat objectStat = await _minioClient.StatObjectAsync(statObjectArgs);
Console.WriteLine(objectStat);
}
catch (MinioException e)
{
Console.WriteLine("Error occurred: " + e);
}
I can't find out what I'm doing wrong because it doesn't throw any errors. I am trying to send the file from IFormFile to minio as below, but when I go into minio I see that the file is not loaded. Minio is installed with default settings as docker-compose with one empty bucket and access keys defined.
BucketExistsAsync returns 'true'. There is no problem with the api key.
Version: .NET 6.0 Minio SDK: 6.0.3