The RC build also includes built-in model-binder support for
uploaded files and multi-part mime content.
For example, we could have a <form> whose enctype
attribute is set to “multipart/form-data” perform a post to the /PhotoManager/UploadPhoto
URL. If a <input type=”file” name=”fileToUpload”/> element was
within the form it would cause the file selected by the end-user to be passed
to our action method as an HttpPostedFileBase object:
Figure 42
We could then use the HttpPostedFileBase object to get
access to the raw bytes of the uploaded file, its mime-type, and optionally
save it to a database or disk.