使用PHP如何通过外部URL将对象放入Amazon S3?
假设我有一个URL:http://example.com/file.avi,我想把它移动到我的存储桶中,而不需要先下载到本地再重新上传。这可行吗?
使用PHP如何通过外部URL将对象放入Amazon S3?
假设我有一个URL:http://example.com/file.avi,我想把它移动到我的存储桶中,而不需要先下载到本地再重新上传。这可行吗?
你可以使用S3.php通过tpyo https://github.com/tpyo/amazon-s3-php-class来实现。
即使它没有包含在ReadMe文件中,你也可以使用它的putObjectString()静态函数,但你必须先将url转换为字符串文件,方法如下:
$fileUrl = file_get_contents("http://www.somesite.com/imagesample.png");
S3::putObjectString($fileUrl, "yourBucket", "uploads/filenamehere.png");
更多细节请参考:https://gist.github.com/neilmaledev/d255c42f1289a9ab9394121b7896d4d3