I have a form where a user can upload a file to the sites download section. However when the form is submitted I get this error, without the request ever making it to the ac
Ok I figured this out finally, It was all caused because I named the file input on the form the same as my models file field, so the model binder was picking this up and trying to bind the posted file directly to the binary property which was throwing an exception because the string was not binary.
So to fix it I simply added this to my create action method:
[HttpPost]
[Authorize]
public ActionResult Create([Bind(Exclude = "DownloadFile")] Download dl, HttpPostedFileBase DownloadFile)
{
By telling the model binder to exclude the field it solved the problem.
Thanks, Alex.
EDIT: This could also easily be solved by using view models