简体   繁体   English

Amazon s3-上传后调用文件

[英]Amazon s3 - Call file after upload

I'm using a php script to upload a file to Amazon S3 我正在使用php脚本将文件上传到Amazon S3

$s3->putObjectFile($url,$bucket,$filename, S3::ACL_PRIVATE,array(),array("Content-Type" => "application/json"));

Immediately after the upload, I need to get some information from the file and I call it through Cloudfront but I see that the file is available only after some minutes. 上传之后,我需要立即从文件中获取一些信息,并通过Cloudfront对其进行调用,但我发现该文件仅在几分钟后才可用。

Do you know why and if there is a way to sort this out? 您知道为什么吗?是否有办法解决? Is there a way to have the file immediately available? 有没有办法使文件立即可用?

Thank you 谢谢

It was immediately available for me with this test... 此测试对我立即可用...

$ date;aws s3 cp foo s3://BUCKET/foo;date;curl -I http://dxxx.cloudfront.net/foo;date

Thu Aug  6 04:30:01 UTC 2015
upload: ./foo to s3://BUCKET/foo
Thu Aug  6 04:30:02 UTC 2015
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 24
Connection: keep-alive
Date: Thu, 06 Aug 2015 04:30:03 GMT
x-amz-version-id: null
Last-Modified: Thu, 06 Aug 2015 04:30:03 GMT
ETag: "5089fc210a3df99a6a04fe64c929d8e7"
Accept-Ranges: bytes
Server: AmazonS3
X-Cache: Miss from cloudfront
Via: 1.1 fed2ed9d8e7c2b37559eac3b2a2386fc.cloudfront.net (CloudFront)
X-Amz-Cf-Id: gEaAkLCqstyAdakXkBvMmSJVrfKjKTD5K9WoyZBHvVZufWuuhclNLQ==

Thu Aug  6 04:30:02 UTC 2015

Perhaps your upload is happening asynchronously and the upload hadn't completed yet? 也许您的上传是异步进行的,但尚未完成上传?

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

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