如何从一个远程服务器上直接上传文件到Amazon S3?上传文件、器上、直接、Amazon

2023-09-11 09:13:15 作者:仙女味的糖果

是否有可能从远程服务器上传文件到S3?

远程服务器基本上是一个基于URL文件服务器。例如,使用 http://example.com/1.jpg ,它服务的形象。它不会做别的,不能在此服务器上运行code。

有可能有另一台服务器,告诉S3上传从 http://example.com/1.jpg

文件

 载从http://example.com/1.jpg
服务器-------------------------------------------> S3< -----> example.com
 

解决方案 远程共享文件怎么设置 win7系统如何开启远程桌面共享文件

如果您不能在服务器上运行code或执行请求的话,不,你不能这样做。你必须要下载文件到您自己的服务器或计算机,并上传到了。

您可以看到的操作,你可以在Amazon S3在执行http://docs.amazonwebservices.com/AmazonS3/latest/API/APIRest.html

检查作业的同时REST和SOAP的API你会看到有没有办法给Amazon S3的远程URL,并把它抓住对象为您服务。所有的PUT请求的要求将其作为请求的一部分的对象的数据。这意味着正在发起web请求需要有数据的服务器或计算机。

我曾在那里,我想我的下载用户的Facebook的缩略图,并将其上传到S3为我的网站上使用过去的类似的问题。我做的方式是下载从Facebook图片到内存我的服务器上,然后上传到Amazon S3 - 在2秒的全部事情了。后上传到S3完成后,写桶/键到数据库。

不幸的是有没有其他办法做到这一点。

Is it possible to upload a file to S3 from a remote server?

The remote server is basically a URL based file server. Example, using http://example.com/1.jpg, it serves the image. It doesn't do anything else and can't run code on this server.

It is possible to have another server telling S3 to upload a file from http://example.com/1.jpg

           upload from http://example.com/1.jpg 
server -------------------------------------------> S3 <-----> example.com

解决方案

If you can't run code on the server or execute requests then, no, you can't do this. You will have to download the file to a server or computer that you own and upload from there.

You can see the operations you can perform on amazon S3 at http://docs.amazonwebservices.com/AmazonS3/latest/API/APIRest.html

Checking the operations for both the REST and SOAP APIs you'll see there's no way to give Amazon S3 a remote URL and have it grab the object for you. All of the PUT requests require the object's data to be provided as part of the request. Meaning the server or computer that is initiating the web request needs to have the data.

I have had a similar problem in the past where I wanted to download my users' Facebook Thumbnails and upload them to S3 for use on my site. The way I did it was to download the image from Facebook into Memory on my server, then upload to Amazon S3 - the full thing took under 2 seconds. After the upload to S3 was complete, write the bucket/key to a database.

Unfortunately there's no other way to do it.

 
精彩推荐