简体   繁体   English

将小缩略图从iPhone应用程序上传到Amazon S3

[英]upload small thumbnail images from iPhone app to Amazon S3

I noticed couple thread on this already and they even provided sample code. 我已经注意到有几个线程,他们甚至提供了示例代码。

http://brunofuster.wordpress.com/2010/11/03/uploading-an-image-from-iphone-with-uiimagepicker-and-asihttprequests3/ http://brunofuster.wordpress.com/2010/11/03/uploading-an-image-from-iphone-with-uiimagepicker-and-asihttprequests3/

But what baffled me is that - there was no response to get handled? 但是令我感到困惑的是-没有得到回应的回应吗? is it because that s3 doesn't return any response? 是因为s3没有返回任何响应吗? I am expecting to receive at least an URL to the image on S3, how could I get that? 我希望至少收到S3上图像的URL,如何获得?

If you look at the S3 REST object PUT documentation you will see the response that is returned from S3. 如果查看S3 REST对象PUT文档,您将看到从S3返回的响应。

When you post to S3 you know the bucket name you are putting the image into plus you know the filename. 当您发布到S3时,您会知道要存储的存储桶名称以及文件名。 These two pieces of information should be all you need to get a url to the image. 这两个信息应该是获取图像URL所需的全部信息。

The documentation states that in addition to the PUT response header(s) you can see some of the common headers too. 该文档指出,除了PUT响应标头之外,您还可以看到一些常见标头。

This implementation of the operation can include the following response headers in addition to the response headers common to all responses. 除了所有响应共同的响应头之外,该操作的实现还可以包括以下响应头。 For more information, see Common Response Headers . 有关更多信息,请参见通用响应头

If you look at the ASIHTTPRequest Amazon Simple Storage Service (S3) support you will see how to get a response from the ASIS3ObjectRequest object. 如果您查看ASIHTTPRequest Amazon Simple Storage Service(S3)支持,您将看到如何从ASIS3ObjectRequest对象获取响应。

Tom, 汤姆

If you wish to just get your S3 image url, you don't need the response information considering you already know the image name and the bucket (if there was no error). 如果您只想获取S3图像URL,则不需要响应信息,因为您已经知道图像名称和存储桶(如果没有错误)。

Anyway, you can get the response from a sync request by using [request responseString|responseData]. 无论如何,您可以使用[request responseString | responseData]从同步请求中获取响应。

But the right thing to do is an async call using operation queues and delegates to get the response success or error. 但是正确的做法是使用操作队列和委托进行异步调用以获取响应成功或错误。 My blog post just provided a minimal sample. 我的博客文章仅提供了一个最小的示例。 I will look into that and improve the post itself. 我将对此进行调查并改善帖子本身。

Thanks! 谢谢!

除了已经提供的答案之外,您可能还需要查看Amazon最近发布的适用于iOS的AWS开发工具包 ,其中包括用于将图像等上传到S3的示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM