using Microsoft.AspNetCore.Mvc; using Minio.DataModel; using Minio; using System.Security.Cryptography; namespace NeDvachAPI.DBControllers { public class MinIOchat { public static async Task PictureUpload(string fileroute, string filename, string bucket) { MinioClient DvachIo = new MinioClient() .WithEndpoint(AuthInfo.MinIo.endpoint) .WithCredentials(AuthInfo.MinIo.username, AuthInfo.MinIo.password) //.WithSSL() .Build(); Aes aesEncryption = Aes.Create(); aesEncryption.KeySize = 256; aesEncryption.GenerateKey(); var ssec = new SSEC(aesEncryption.Key); PutObjectArgs putObjectArgs = new PutObjectArgs() .WithBucket(bucket) .WithObject(filename) .WithFileName(fileroute) .WithContentType("image/png"); //.WithServerSideEncryption(ssec); await DvachIo.PutObjectAsync(putObjectArgs); GC.Collect(); GC.WaitForPendingFinalizers(); File.Delete(fileroute); return new JsonResult("http://static.vdk2ch.ru:15555/thread-pics/" + filename); } } }