Help replacing AWS code on script

Hi, I’m looking to integrate Stream into my website, currently it’s set up for AWS: this is the current code that deals with uploading (I’m going to retrofit the stream code into this IF statement) and use aws_key & aws_secret in insert my stream key & id :

if (qa_opt(‘enable_aws’)) {

        require QA_INCLUDE_DIR . 's3/aws.phar';
        $s3Client = new Aws\S3\S3Client([
        'region'  => ''.qa_opt('aws_region').'',
        'version' => 'latest',
        'credentials' => [
              'key'    => ''.qa_opt('aws_key').'',
              'secret' => ''.qa_opt('aws_secret').''

        $result = $s3Client->putObject([
            'Bucket' => ''.qa_opt('aws_bucket').'',
            'Key'    => $NewFileName,
            'SourceFile' => $TempSrc          
        $output = king_insert_uploads($result['ObjectURL'], $temptype, null, null, 'aws');
        $path  = $result['ObjectURL'];


So I’ve got the source file being uploaded as $TempSrc, got a unique file name $NewFileName (might not be needed)

and I need to generate the $path (final url to file).

these are 1min long videos under 100mb.

Any help would be greatly appreciated,

Can you share which step you are running into a problem with? Assuming your script is basically trying to upload videos that currently reside on S3 to Stream, you could call the Upload via Link API to have Stream fetch, encode and make the video available for streaming. See