s3使用php上传文件,php – 将大型文件上传到S3,并提供恢复支持

更新20150527

更新20120412

我的初步答案显然错过了要点,所以要澄清:

如果您想通过简单的HTML表单进行基于浏览器的上传,那么您将受限于使用POST Object operation,它使用HTML表单将对象添加到指定的存储桶中:

POST is an alternate form of PUT that enables browser-based uploads as

a way of putting objects in buckets. Parameters that are passed to PUT

via HTTP Headers are instead passed as form fields to POST in the

multipart/form-data encoded message body. […]

上传在这里进行单一操作,因此不支持暂停/恢复,并限制您的原始最大对象大小为5 GB或更少.

这显然需要一个服务器(例如在EC2上)来处理通过浏览器启动的操作(这样可以方便S3 Bucket Policies和/或IAM Policies访问控制).

另一种可能是使用JavaScript库并执行此客户端,请参阅jQuery Upload Progress and AJAX file upload初始指针.不幸的是,没有AWS的规范JavaScript SDK可用(aws-lib令人惊讶地甚至不支持S3) – 显然,knox的一些分支已经添加了多部分上传,例如. slakis’s fork,我没有使用任何一个用于手边的用例.

初始答案

If it’s possible to upload [large files] directly to S3, how can I handle

pause/resume?

The AWS SDK for PHP exposes a low-level API that closely resembles the

Amazon S3 REST API for multipart upload (see Using the REST API for

Multipart Upload ). Use the low-level API when you need to pause and

resume multipart uploads, vary part sizes during the upload, or do not

know the size of the data in advance. Use the high-level API (see

Using the High-Level PHP API for Multipart Upload) whenever you don’t

have these requirements. [emphasis mine]

Amazon S3可以将对象从1字节一直处理到5TB(TB),请参阅各自的入门职位Amazon S3 – Object Size Limit Now 5 TB:

[…] Now customers can store extremely

large files as single objects, which greatly simplifies their storage

experience. Amazon S3 does the bookkeeping behind the scenes for our

customers, so you can now GET that large object just like you would

any other Amazon S3 object.

In order to store larger objects you would use the new 070017 that I blogged about last month to upload the object in parts. […]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值