<?php
require_once __DIR__ . '/config.php'; // doit définir $s3Client et $bucketName

// crée un petit fichier temporaire
$tmp = '/tmp/test_minio_upload_'.time().'.txt';
file_put_contents($tmp, "test upload ".time());

try {
    $key = "uploads/test_manual_".time().".txt";
    $res = $s3Client->putObject([
        'Bucket' => $bucketName,
        'Key' => $key,
        'SourceFile' => $tmp,
        'ACL' => 'public-read',
        'ContentType' => 'text/plain'
    ]);
    echo "OK upload: ".$res['ObjectURL'].PHP_EOL;
} catch (Exception $e) {
    echo "ERR: ".$e->getMessage().PHP_EOL;
    echo $e->getTraceAsString();
}
