Join Jess Chadwick for an in-depth discussion in this video Solution: Process an uploaded image file, part of ASP.NET Core: Razor Pages.
- [Instructor] Like the implementation…of an HTML form, the solution to this challenge…involves changes to both the client side and server side.…In order to solve this challenge, you had to do…three things.…Add a new property to the page model…to bind the image file information to,…add a new form field to the markup pointing…to this new property on the page model,…and finally copying the posted image data…from the new page model property to the recipe itself.…
So let's take a look at how I implemented my solution.…I'll start with step one, adding the new property…to the page model just to handle the uploaded file.…As I mentioned in the introduction to the challenge,…the type of this new property should be IFormFile.…And IFormFile lives in the Microsoft.AspNetCore.Http…name space so be sure to import that.…Then I'll give the new property a wonderfully creative name.…
Let's call it image.…Then I'll use the bind property attribute…on this new property just like I did…on the recipe property above it.…Next, I'll switch to the markup and add a new form field…
- 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.