简体   繁体   English

我可以使用PHP直接上传到Amazon S3存储桶而无需将其保存在本地系统中吗?

[英]Can I upload directly to Amazon S3 bucket using PHP without saving it in loc al system?

I am taking the input of a file using multipart form data using a post form over the cloud. 我正在使用通过邮寄表单在云端使用多部分表单数据进行文件输入。 Can I be able to upload it directly to the Amazon S3 Bucket without saving it on the local system? 是否可以将其直接上传到Amazon S3存储桶而无需将其保存在本地系统上? I tried it by saving on the local system and then uploading it to the s3 Bucket. 我通过保存在本地系统上,然后将其上传到s3存储桶中进行了尝试。 It worked fine but I want to know that can it be uploaded directly using the post form without saving it to the local system. 它工作正常,但我想知道可以使用帖子表格直接上传它,而无需将其保存到本地系统。

it could probably be done with stream wrapper of the S3 SDK. 可以使用S3 SDK的流包装器来完成。 Read in chunks from php://input and write to s3, however, php://input is not available with enctype="multipart/form-data". 从php:// input读取块并写入s3,但是,php:// input不能与enctype =“ multipart / form-data”一起使用。

But why not upload to your S3 bucket directly from the client using a presigned POST URL ? 但是,为什么不使用预先签名的POST URL直接从客户端上载到S3存储桶呢?

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

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