Amazon S3的POST,事件的时候做了什么?时候、事件、Amazon、POST

2023-09-11 09:06:38 作者:寂寞、带点伤

我使用Amazon S3的一个简单的项目,当用户上传一个文件,我先用一个XMLHTT prequest的详细信息发送到我的数据库,然后触发表单POST的直接上传文件到S3

I'm using Amazon S3 with a simple project, when the user uploads a file, I first use an XMLHTTPRequest to send the details to my database, then trigger the form POST that uploads the file straight to S3.

我不是很锻炼虽然是怎样当上载完成这样我就可以适当地更新显示(我在作弊的时刻,刚刚更新显示,一旦它保存在数据库中,你可以告诉勉强告诉了小上传,但很明显,从长远来看有问题。)

What I can't quite work out though is how to tell when the upload is done so I can update the display properly (I'm cheating at the moment and just updating the display once it's saved in the database, you can barely tell for small uploads, but obviously a problem in the long run.)

在S3服务器显示为取消导航,一旦上传完成,所以页面不会重新加载 - ?有没有被解雇了,我可以用它来检测时,上传完成后的任何事件

The S3 server appears to "cancel navigation" once the upload is complete, so the page doesn't reload - are there any events that are fired that I can use to detect when the upload is complete?

感谢

编辑:我使用的形式code从这里的 http://s3.amazonaws.com/doc/s3-example-$c$c/post/post_sample.html 只是增加了一个的onsubmit到触发XMLHTT prequest形式以我自己的服务器之前的形式被发布到亚马逊。

I'm using the form code from here http://s3.amazonaws.com/doc/s3-example-code/post/post_sample.html just added an onsubmit to the form that fires the XMLHTTPRequest to my own server before the form gets posted to amazon.

推荐答案

亚马逊S3将重定向到 success_action_redirect 字段中指定的URL或者如果没有指定,则返回在 success_action_status 指定的状态code一个空文件。

Amazon S3 will redirect to the url specified in the success_action_redirect field or if that's not specified, it returns an empty document with the status code specified in success_action_status.

在开机自检完成后,用户被重定向到您在success_action_redirect字段中指定的位置。如果亚马逊S3不能跨preT的URL,它忽略了success_action_redirect领域。

On completion of the POST, the user is redirected to the location that you specified in the success_action_redirect field. If Amazon S3 cannot interpret the URL, it ignores the success_action_redirect field.

如果没有指定success_action_redirect是,亚马逊的S3返回在success_action_status字段中指定的空白文档类型。

If success_action_redirect is not specified, Amazon S3 returns the empty document type specified in the success_action_status field.

如果POST失败,Amazon S3的显示错误,不提供重定向。

If the POST fails, Amazon S3 displays an error and does not provide a redirect.

请参见 AWS文档了解更多详情。