\n"; if (count($argv) <= 2) { echo $USAGE; exit(); } $bucket = $argv[1]; $file_Path = $argv[2]; $key = basename($argv[2]); try { //Create a S3Client $s3Client = new S3Client([ 'profile' => 'default', 'region' => 'us-west-2', 'version' => '2006-03-01' ]); $result = $s3Client->putObject([ 'Bucket' => $bucket, 'Key' => $key, 'SourceFile' => $file_Path, ]); } catch (S3Exception $e) { echo $e->getMessage() . "\n"; } // snippet-end:[s3.php.put_object.main] // snippet-end:[s3.php.put_object.complete]