Last changes before exam

This commit is contained in:
Cristiano
2026-06-09 20:11:33 +02:00
parent d17f2fb23e
commit f54f5e02dc
9 changed files with 52 additions and 52 deletions
+4 -4
View File
@@ -7,12 +7,12 @@ public class StorageService(IAmazonS3 amazonS3, IConfiguration config)
{
private readonly string _bucket = config["RustFs:BucketName"]!;
private readonly string _url = config["RustFs:ServiceUrl"]!;
public async Task<string> UploadFile(IFormFile file, string type, CancellationToken ct)
{
if (file.Length == 0) throw new Exception("Fichier vide");
string key = $"settings/{type}";
string key = $"settings/{type}/{Guid.NewGuid()}";
using MemoryStream memoryStream = new();
await file.CopyToAsync(memoryStream, ct);
@@ -25,7 +25,7 @@ public class StorageService(IAmazonS3 amazonS3, IConfiguration config)
InputStream = memoryStream,
Key = key,
};
await amazonS3.PutObjectAsync(uploadRequest, ct);
return key;
}