Files
cmss-projet/forum-project/test_minio_upload.php
2025-11-03 21:53:58 +01:00

22 lines
591 B
PHP

<?php
require_once __DIR__ . '/config.php'; // doit définir $s3Client et $bucketName
$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();
}