Initial commit - Mini CMS complet (PHP + Docker + MinIO)
This commit is contained in:
21
forum-project/test_minio_upload.php
Normal file
21
forum-project/test_minio_upload.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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();
|
||||
}
|
||||
Reference in New Issue
Block a user