AWS PHP Containers
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
question

AWS PHP Containers

Par
JeromeS39
Créé le 2022-01-05 07:58:55 (edited on 2024-09-04 13:52:02) dans Public Cloud OVHcloud

bonjour,
je peux créer une connexion via :

$s3Client = new S3Client(['profile' => 'default','endpoint' =>'http://storage.sbg.cloud.ovh.net', 'region' => 'SBG','version' => latest','credentials' => array('key' => $key,'secret' => $secret,)]);

et lister mes containers existants sans soucis donc la connexion est OK:
$result = $s3Client->listBuckets();var_dump($result);)

mais je n arrive pas a créer de nouveau container avec :
$s3Client->createBucket(array('Bucket' => 'cont1',));

=> Je le cré manuellement via le site ovh:swift,SBG,private,cont1.
Lorsque je veux envoyer un fichier dans ce container :
$result = $s3Client->upload('cont1', 'test.123', fopen($file_name, 'rb'), 'public-read');

ne fonctionne pas mais si je met 'cont1/' (avec le slash) il me cré bien un objet dans 'cont1' mais qui s appelle '/test.123'

Quelle est la bonne requête pour créer un container et celle pour mettre un fichier dans ce container.

Merci.
JJS