Join Joseph LeBlanc for an in-depth discussion in this video Solution: Downloading immediately, part of Learning Cloud Storage APIs.
So here's my solution to the challenge. I'm not going to upload a photo, and when…I click Submit it uploads the photo to S3 and then download it immediately.…Let's got to the S3 console. When I refresh the bucket, the image that…I just uploaded appears, so let's take a look at how I did this.…Go to app and index.js. And now scroll down to the bottom.…Lines 47 through 51 are the same as before.…We're reading the uploaded file from disk, and then we're specifying the bucket, and…then we're specifying the key name that we want to use.…
On line 53, we're then sending the request.…After getting a response from the server, instead of showing the upload form, we…then perform the download. On lines 54 through 57, we construct a…download object. This object specifies the bucket as well…as the key. Notice that on both line 50 and line 56.…We're using req.files.uploadedFile.name. This is the file name that was specified…during the upload. Finally, on line 59, we're calling get object.…
The first argument we're passing is the download object we just constructed.…
- Why use cloud storage?
- Granting access to Amazon S3 buckets
- Displaying bucket contents
- Downloading files immediately
- Creating a Dropbox application
- Finding, downloading, and uploading files
Skill Level Beginner
1. Cloud Storage Overview
2. Accessing Amazon S3 Buckets via REST
3. Other Container-Based Services
4. Creating Dropbox Apps
5. Other App-Driven Services
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.