Handling file uploads is more complicated than one might think. This video covers the different ways a browser can send files to a server.
- [Instructor] When we look at our registration form,…we see that it already contains a file upload field.…Now one could assume that this is sufficient…to send a file to a server.…Unfortunately, it's not that easy.…Let's fill out the form and inspect the payloads…to understand the problems…so I'm just putting in some bogus data.…Some password, and I will also…choose a file…to be uploaded and I'm opening from development tools…I select preserve log so that the redirect won't clear…the history and I click submit.…
Now when I look into this registration request,…we see on the bottom of the headers the request headers.…If we scroll down in it,…we see that there is also a section for form data.…And there we see that we are transmitting a few fields.…If we look at the source, we see that the data…is encoded similar to a theory stream…if we do a get request.…
We also see in the payload that while the file name…of the uploaded image was sent,…the binary data is missing.…This is because, to upload a file,…we need to change the encoding of the form…
Author
Released
2/7/2019- Creating a template engine
- Using MongoDB and Mongoose for user management
- Authenticating and authorizing users
- Adding cookies and sessions to Express
- Creating a login form with Passport
- Handling file uploads
- Storing and serving images
- Deploying an Express application
- Securing an Express application
- Running behind a web server
Skill Level Advanced
Duration
Views
Related Courses
-
Advanced Node.js
with Alex Banks2h 3m Advanced -
Advanced Node.js: Scaling Applications
with Alex Banks1h 15m Advanced
-
Introduction
-
What you should know1m 20s
-
Get your tools ready2m 1s
-
1. Know the Building Blocks and Internals of Express
-
Important Express middleware1m 27s
-
2. Use MongoDB and Mongoose to Manage Users
-
Connecting to MongoDB3m 27s
-
3. Authenticate and Authorize Users
-
Introduction to Passport1m 39s
-
Adding Passport to Express3m 55s
-
Providing a logout link2m 1s
-
Protecting routes3m 35s
-
4. Handle File Uploads and Process Images
-
File upload basics3m 9s
-
Serving images6m 32s
-
-
5. Deployment and Running in Production
-
Add logging5m 3s
-
Conclusion
-
Next steps44s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: File upload basics