使用php将文件从Google Drive上传到S3 Server

时间:2015-05-11 11:05:18

标签: php amazon-s3 google-api-php-client

我想将文件从谷歌硬盘上传到S3服务器。我使用Google Picker从谷歌驱动器中选择文件。不幸的是,我在选择文件后很难将文件上传到s3。

我使用了file_get_contents(file_url),然后上传到s3服务器。它在dropbox api中运行良好。但我无法通过google drive返回网址。

请问您能分享我的想法和建议吗?

1 个答案:

答案 0 :(得分:0)

尝试这个S3类:s3 class

<?php
require( "s3.class.php" );
$contents = file_get_contents(file_url);
$s3svc = new S3();
$s3svc->putBucket('bucketName');
$objs = $s3svc->getObjects('bucketName');
$out = $s3svc->putObject( $filename, $contents, 'bucketName',$permissions, $fileType );
?>