使用进度条将文件直接上传到 S3

发布于 2024-07-12 19:54:27 字数 1539 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冷月断魂刀 2024-07-19 19:54:28

html5 javascript 可以让你做到这一点,如果你不介意缺乏浏览器支持(截至本文仅支持 Firefox 和 Chrome_)
示例如下: https://developer.mozilla.org/en/Using_files_from_web_applications

这不是具体的到 AWS,但可能会帮助您更接近。

html5 javascript can allow you to do it, if you don't mind lack of browser support (Firefox and Chrome only as of this post_
Example here: https://developer.mozilla.org/en/Using_files_from_web_applications

This isn't specific to AWS, but may help you get closer.

神妖 2024-07-19 19:54:28

另一种方法是使用 Uber Uploader (http://uber-uploader.sourceforge.net/) 这是一个带有进度条的 perl / php 混合解决方案。 您只需将文件上传到您的服务器,然后让您的服务器在后台通过 FTP 将它们传输到最终目的地。 这是一个额外的步骤,但它为您提供了一些时间来执行发送到 S3 之前可能需要执行的任何处理/编码/等操作。

Another approach is to use something like Uber Uploader (http://uber-uploader.sourceforge.net/) which is a perl / php hybrid solution with a progress bar. You would simply upload the files to your server and then have your server FTP them in the background to the final destination. It is an extra step but it gives you some time to do any processing / encoding / etc. that you may need to do before sending to S3.

七禾 2024-07-19 19:54:27

我也在寻找解决方案。 也许这会有所帮助,

来自 AWS 开发社区
但在许多语言(PHP、Java)中,对于
大文件,你必须使用流
通过它,语言环境
将占用您的大文件的一部分
在另一个之后(为了填满
中央存储器具有大量
需要 S3 的 http POST 数据
用于上传。

流的好处在于
他们有一个回调函数,每当
读取下一个块以进一步进行
将(https 意义上的)数据放入 S3。
您可以使用此回调来计算
并在客户端显示进度
用户界面。

请参阅 libcurl 的文档以查看
详细说明了这一切是如何工作的。


更新:看起来有两个简单的选择。

  1. Flash,通过 FileReference 类
  2. 使用 Java 小程序

我个人讨厌使用第 3 方扩展(Flash、Java)使应用程序功能,但我还没有找到其他方法。

I'm looking for a solution as well. Maybe this will be of some help,

From AWS Dev Commnity
But in many languages (PHP, Java), for
big files, you have to use streams
through which the language environment
will take chunks of your big file one
after the other (in order to fill up
central memory with huge amount of
data for the http POST of S3 needed
for the upload.

The nice thing about stream is that
they have a callback called whenever
the next chunk is read for to further
PUT (in the https sense) data to S3.
You can use this callback to compute
and display the progress on the client
UI.

See the doc of libcurl to see in
details how all this works.


Update: It looks like there are two straightforward options.

  1. Flash, via the FileReference class
  2. With a Java applet

I personally hate using 3rd party extensions (Flash, Java) to make an app function, but I haven't found another way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文