Support IFormFile binding on complex [FromForm] models#2145
Merged
jeremydmiller merged 1 commit intomainfrom Feb 9, 2026
Merged
Support IFormFile binding on complex [FromForm] models#2145jeremydmiller merged 1 commit intomainfrom
jeremydmiller merged 1 commit intomainfrom
Conversation
IFormFile and IFormFileCollection properties on complex models annotated with [FromForm] are now automatically bound from multipart form data. Previously only direct method parameters of these types were supported. Also accept multipart/form-data content type on all form data endpoints alongside application/x-www-form-urlencoded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IFormFileandIFormFileCollectionproperties on complex models annotated with[FromForm]are now automatically bound from multipart form dataIFormFile/IFormFileCollectionwere supported viaFromFileStrategy. TheFormBindingFramethat handles complex model property binding calledTryFindOrCreateFormValue()for each property, which had no handling for file types — silently skipping themReadFormFileByNamehelper toHttpHandlerthat reads a form file by field name viaIFormFileCollection.GetFile()FormFilePropertyFrameandFormFileCollectionPropertyFramecode generation frames for property-level file bindingFormBindingFrameto detectIFormFile/IFormFileCollectionin both constructor parameters and settable propertiesmultipart/form-datacontent type on all form data endpoints alongsideapplication/x-www-form-urlencodedTest plan
bind_single_file_on_complex_model— verifiesIFormFileproperty is bound with correct filename and lengthbind_file_collection_on_complex_model— verifiesIFormFileCollectionproperty is bound with correct file countbind_file_on_complex_model_when_no_file_sent— verifiesIFormFileproperty is null when no file is sentfrom_form_bindingtests pass (11 passed, 2 skipped due to pre-existing Alba limitation)🤖 Generated with Claude Code