2017 © Pedro Peláez
 

library s3multiupload

A class for uploading direct to s3 with chunked uploads

image

joegreen0991/s3multiupload

A class for uploading direct to s3 with chunked uploads

  • Tuesday, August 13, 2013
  • by mrjgreen
  • Repository
  • 1 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

s3multiupload

Full example for uploading directly to Amazon S3 with plupload and chunked uploads https://github.com/joegreen0991/chunkedPluploadToS3Example, (*1)

    // We need to give our class an instance of the S3Client
    $s3Client = \Aws\Common\Aws::factory(array(
      'key'    => S3_KEY,
        'secret' => S3_SECRET,
        'region' => S3_REGION
    ))->get('s3');

    // We also need to pass in a storage handler, so we can remember the multipart_id between requests - use native sessions, or roll your own
    $keyStorage = new S3MultiUpload\KeyStorage\NativeSession;

    // Create our object to manage the signing server side - we generate the url and all the params, but hand it back to the client to send the actual data
    $s3 = new S3MultiUpload\Client($s3Client, $keyStorage);


    switch ($_REQUEST['action']) {

        case 'sign' :

            if(empty($_REQUEST['uploadId'])){
                // This is a new upload

                $filename = $_REQUEST['name']; // Using original file name, but you could use randomly generated names etc...

                $multipart_id = $s3->createMultipart(S3_BUCKET, $filename);

            }else{

                $multipart_id = $_REQUEST['uploadId'];
            }

            die(json_encode($s3->signMultipart($multipart_id, $_REQUEST['chunk'], array('Content-Type' => 'application/octet-stream'))));

        case 'complete' :

            die(json_encode($s3->completeMultipart($_REQUEST['uploadId'])));

    }

The Versions

13/08 2013

dev-master

9999999-dev

A class for uploading direct to s3 with chunked uploads

  Sources   Download

The Requires

 

s3 upload chunked direct