2016-02-08 49 views
1

我知道如何使用laravel从本地存储上传文件到aws。但我想直接从外部网址上传文件到aws而无需下载。从URL上传文件到AWS laravel

任何建议,我该如何做到这一点。

+0

有太多可能的答案,或者对于这种格式太好的答案太长。请添加详细信息以缩小答案集或隔离可在几个段落中回答的问题。我建议您找到一个开发论坛(也许[Quora](http://www.quora.com/Computer-Programming) )?)来计算一般性。然后,当/如果您有特定的编码问题,请回到StackOverflow,我们很乐意提供帮助。 –

+0

谢谢@JayBlanchard,但我无法找到任何正在阐述这一点的链接,它也没有在laravel文档中提及。你能分享一些资源的链接吗? –

回答

2

我终于用Intervention Image Library解决了这个问题。

use Image; 
use Storage; 


$image = Image::make('url'); 
$image->encode('jpg'); 
$s3 = Storage::disk('s3'); 
$filePath = '/profilePhotos/'.$time(); 
$s3->put($filePath, $image->__toString(), 'public'); 

在“Laravel集成”一节中可找到Image library的安装说明here