Amazon AWS SDK Guide d'installation Page 118

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 151
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 117
// Seek to the beginning of the stream
$result['Body']->rewind();
// Read the body off of the underlying stream in chunks
while ($data = $result['Body']->read(1024)) {
echo $data;
}
// Cast the body to a primitive string
// Warning: This loads the entire contents into memory!
$bodyAsString = (string) $result['Body'];
Saving objects to a file
You can save the contents of an object to a file by setting the SaveAs parameter.
$result = $client->getObject(array(
'Bucket' => $bucket,
'Key' => 'data.txt',
'SaveAs' => '/tmp/data.txt'
));
// Contains an EntityBody that wraps a file resource of /tmp/data.txt
echo $result['Body']->getUri() . "\n";
// > /tmp/data.txt
Uploading large files using multipart uploads
Amazon S3 allows you to uploads large files in pieces. The AWS SDK for PHP provides an abstraction layer that
makes it easier to upload large files using multipart upload.
use Aws\Common\Enum\Size;
use Aws\Common\Exception\MultipartUploadException;
use Aws\S3\Model\MultipartUpload\UploadBuilder;
$uploader = UploadBuilder::newInstance()
->setClient($client)
->setSource('/path/to/large/file.mov')
->setBucket('mybucket')
->setKey('my-object-key')
->setOption('Metadata', array('Foo' => 'Bar'))
->setOption('CacheControl', 'max-age=3600')
->build();
// Perform the upload. Abort the upload if something goes wrong
try {
$uploader->upload();
echo "Upload complete.\n";
} catch (MultipartUploadException $e) {
$uploader->abort();
echo "Upload failed.\n";
}
You can attempt to upload parts in parallel by specifying the concurrency option on the UploadBuilder object. The
following example will create a transfer object that will attempt to upload three parts in parallel until the entire object
has been uploaded.
$uploader = UploadBuilder::newInstance()
->setClient($client)
->setSource('/path/to/large/file.mov')
->setBucket('mybucket')
Amazon Simple Storage Service
106
Vue de la page 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 150 151

Commentaires sur ces manuels

Pas de commentaire

Velleman WEH200 Handbücher

Bedienungsanleitungen und Benutzerhandbücher für Ausrüstung Velleman WEH200.
Wir stellen 1 PDF-Handbücher Velleman WEH200 zum kostenlosen herunterladen nach Dokumenttypen zur Verfügung Bedienungsanleitung






Weitere Produkte und Handbücher für Ausrüstung Velleman

Modelle Dokumententyp
HPS50 Bedienungsanleitung     Velleman HPS50 User Manual, 72 Seiten
LAB2 Bedienungsanleitung      Velleman LAB2 User Manual, 32 Seiten
PCS10 Bedienungsanleitung   Velleman PCS10 User Manual, 7 Seiten
BPAPS230 Bedienungsanleitung   Velleman BPAPS230 User Manual, 2 Seiten
LAB1 Bedienungsanleitung      Velleman LAB1 User Manual, 64 Seiten
PCSU1000 RECORDER Bedienungsanleitung   Velleman PCSU1000 RECORDER User Manual, 7 Seiten
PCS100A pcs100 - pcs500 - k8031 Bedienungsanleitung   Velleman PCS100A pcs100 - pcs500 - k8031 User Manual, 25 Seiten
PCGU1000 Bedienungsanleitung   Velleman PCGU1000 User Manual, 13 Seiten
PCSGU250 Bedienungsanleitung      Velleman PCSGU250 User Manual, 40 Seiten
VDP900HZ2 Bedienungsanleitung      Velleman VDP900HZ2 User Manual, 28 Seiten
VDP1500SM Bedienungsanleitung      Velleman VDP1500SM User Manual, 19 Seiten
VDL800SMT2 Bedienungsanleitung       Velleman VDL800SMT2 User Manual, 23 Seiten
PMLCD Bedienungsanleitung      Velleman PMLCD User Manual, 7 Seiten
VDL400SM Bedienungsanleitung      Velleman VDL400SM User Manual, 19 Seiten
VDP1000SWN Bedienungsanleitung      Velleman VDP1000SWN User Manual [en] , 16 Seiten