File Upload not posting / MVC

I’m trying to upload a file from my view to my controller, but the value is always null.


public ActionResult Edit(AttachmentDto dto, HttpPostedFileBase UploadedFile)

Form Tag:
<form action="@Url.Action("Edit")" method="post" enctype="multipart/form-data">

Input Tag:
<input type="file" name="UploadedFile" id="File"  />

There are few other inputs being passed into the controller that the dto is receiving, however the UploadedFile is always null? Am I missing something here?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

So the mystery turned out to be a JavaScript import that was added to the project by a colleague to handle our form posts. There is already a question regarding posting multipart/formdata using jQuery here:
Sending multipart/formdata with jQuery.ajax

Just added the FormData object and presto.

Thanks for all of your help!

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x