简体   繁体   中英

Amazon s3 - Call file after upload

I'm using a php script to upload a file to 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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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