[英]Upload file to another domain
I've tried to upload an image using Laravel 5.1 from my current domain www.example.com to another domain like cdn.upload.com but still no luck to find a good way to do this.我尝试使用 Laravel 5.1 从我当前的域 www.example.com 上传图像到另一个域,如 cdn.upload.com,但仍然没有找到一个好的方法来做到这一点。 I've tried using:
我试过使用:
$file->move('http://cdn.upload.com/public/images/', $filename);
but it return me error no "cannot create directory".但它返回错误没有“无法创建目录”。
copy('cdn.upload.com', $filename);
but it not copy to the other domain.但它不会复制到其他域。
Or is there any better way to make all image to a CDN?或者有没有更好的方法将所有图像制作到 CDN? so i can access all the images across all domain?.
所以我可以访问所有域中的所有图像? i got about 3 domains need to access the images.
我有大约 3 个域需要访问图像。
Thanks.谢谢。
I use the the Filesystem/Cloud Storage .我使用文件系统/云存储。
If you are using Amazon S3 or Rackspace the support is built in.如果您使用的是 Amazon S3 或 Rackspace,则支持是内置的。
If not, it is fairly simple to implement .如果没有,实现起来相当简单。
The code is代码是
Storage::disk('s3')->put('file.txt', 'Contents');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.