Uploading an image to Amazon S3
Uploading images to your server-side filesystem is actually not a great idea. If you are deploying from your repo, you don't want to mix in user-generated media with your code. A much better and more scalable approach is to put your photos and other media in a completely separate static location, such as Amazon S3, where you can access them without letting them interfere with your core application.
In this recipe, we will upload images to Amazon S3 and display them after they are uploaded.
Getting ready…
For this recipe, we will use the Amazon SDK for Node. It can be installed by running npm install aws-sdk –save
in your terminal. We will also use lodash (npm install lodash --save
) and the q
promise library (npm install ...
Get Socket.IO Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.