Reputation: 496
Hello :) I'm looking at the feasibility of having my node application stream HTTP POST file uploads directly through to an Amazon S3 Bucket.
I'm looking at using Formidable and Knox for this.
The part I'm unsure about is that S3 requires that you know the total number of bytes in the file before transmission.
Would I be right in thinking that the only way to accomplish this then would be to use the HTML5 File API (And possibly an ActiveX control on Internet Explorer) to check the file size on the client and send this as part of the HTTP POST request ?
Upvotes: 2
Views: 4695
Reputation: 6356
With the recent CORS support, you can easily send files directly to s3, without your server having to handle anything.
I recently wrote a short tutorial, with rails, but again the server is just used to compute some keys, so adapting it to express shouldn't be hard at all.
But with such a solution, you'll need to use the jQuery File Upload plugin, and you probably won't need knox
https://pjambet.github.io/blog/direct-upload-to-s3
Hope it'll help you.
Upvotes: 4
Reputation: 40084
Maybe this can help - I made this to use the JQuery File Upload plugin upload directly to S3. I did not need to check the size of the file.
https://gist.github.com/3995819
Upvotes: 0