How can I get last transaction on S3 bucket?
Am a beginner of S3 AWS SDK. and getting problem in my project.
I want to get uploaded or dow开发者_如何转开发nloaded size of file which is currently uploaded. Actually the functionality of my application is that it will upload contents directly from client browser to Amazon S3. But if transfer of data interrupted and if exception is raised then i cant track that how much data of file has be transfered.
If anybody has a solution, please reply.
Thanks
First of all you will not find a "last transaction" functionality in S3. S3 is not transactional, it is a giant hashtable. If your upload fails the item will not exist in your bucket, even if it failed half way though.
Having said that your best option here is to use Flash or Silverlight to upload the file. This way you have access to the file size on the client and can added the appropriate meta tags when uploading the file. It also allows you to give an accurate progress bar.
Have a look at this example.
You can use use ls
command to get the file list in a bucket based on the date:
aws s3 ls s3://mybucket --recursive
if you make --recursive | sort
, the result will be ordered by date. You can pick the last item in the result to get the last modified/uploaded object.
精彩评论