Join Jess Chadwick for an in-depth discussion in this video Challenge: Process an uploaded image file, part of ASP.NET Core: Razor Pages.
- [Instructor] In this chapter,…I showed you how to build a form…using tag helpers and then process…the data from that form on the server.…However, my implementation had one hole…that I actually pointed out.…I didn't add the ability to upload an image,…so the existing image got overwritten…with a null value every time…the form was posted back.…Your challenge is to fix this problem for me…by adding the ability to upload an image file…as a property in the HTML form.…
Also, this image should be optional,…meaning you shouldn't have to select an image…to upload every time you want to change…one of the other fields.…If an image is uploaded with the form,…assign the bytes that were uploaded…to the image property on the recipe object.…If an image is not uploaded with the form post,…just leave the existing image data,…if any, alone.…I've shown you everything you'll need to know…in order to accomplish this task,…except for the following tips.…
In order to attach a file to an HTML form,…you can use the input tag with a type, of file.…
- Creating a new application
- Setting up pages
- Rendering dynamic content
- Reusing markup with layouts
- Increasing the maintainability of pages
- Processing data
- Validating input
- Securing an application
Skill Level Intermediate
Deploying ASP.NET Core Applicationswith Nate Barbettini57m 57s Intermediate
Building Web APIs with ASP.NET Corewith Chris Woodruff1h 7m Intermediate
ASP.NET Core: Test-Driven Developmentwith Richard Rout37m 30s Intermediate
1. Razor Pages Intro
What is Razor Pages?3m 5s
2. Razor Pages Basics
3. Reusing Markup with Layouts
4. Building Maintainable Applications
5. Working with Data
6. Validating User Inputs and Securing Your Application from Unauthorized Users
- 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.