samedi 4 juillet 2015

PHP to AWS S3 multipart upload always fails

Trying to upload a 7G file to S3 using the PHP SDK v2 (PHP 5.5 not available). File uploads less than 5G work great, but multipart uploads don't work at all. They either end with an S3 XML 500 redirect:

<Error><Code>AccessDenied</Code><Message>Access Denied</Message>...

or they end with no error (or message) at all just before the upload completes.

I have full S3 access. Have tried a bunch of different things to no avail. Code is nothing special:

$uploader = UploadBuilder::newInstance() ->setBucket($bucket_nm) ->setKey($key) ->setMinPartSize(100 * 1024 * 1024) ->setConcurrency(1) ->setSource($src_path) ->setClient($s3) ->build(); try { $uploader->getEventDispatcher()->addListener( 'multipart_upload.after_part_upload', function($event) { $msg = $event['state']->count() . ' parts uploaded.'; echo "$msg<br />"; WriteToLog($msg); } ); $uploader->upload(); $msg = 'Upload complete.'; } catch (MultipartUploadException $e) { $uploader->abort(); $msg = 'Upload failed. ' . $e->getMessage() . '.'; } echo "$msg<br />"; WriteToLog($msg);




Aucun commentaire:

Enregistrer un commentaire