Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的宁静服务中使用 Amazon S3 来上传图像。一个 iPhone 应用程序正在访问 restful 服务。我试图弄清楚上传图片的最佳方法是什么。
选项 1:使用多部分表单数据上传图像,并将 JSON 本身作为另一个多部分包含在 HTTP 请求中。
选项 2:将图像直接上传到 Amazon S3 并取回 URL。湾。使用包含图像 URL 的 JSON 发送一个安静的请求。
你会选择哪种方法?
我选择选项 1,因为它是一个请求。它优于 2 次单独的往返行程(在选项 2 中)。