Upload File Directly to S3 with Progress Bar [clos

2019-01-16 06:48发布

问题:

Relating to this question, Upload files directly to Amazon S3 from ASP.NET application, is there any way to do this and have a progress bar?

---- EDIT ----

Two days later and still no luck with a direct way. Found one thing that looks promising but not free: http://www.flajaxian.com/

Uses flash to upload directly to S3 with a progress bar.

回答1:

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.



回答2:

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.



回答3:

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.