Currently I've got a runtime exception: 'Systen.MissingMethodException : No parameterless constructor defined for this object.
I've googled and came across a lot of people actually not having a default contstructor, though my code actually does, so I don't know where it goes wrong!
My full code can be found here on pastebin since its varely large: http://pastebin.com/RxdKgxSx
Thanks for your help!
Replace:
public ActionResult Create(UploadViewItem viewItem, HttpPostedFile postedFile)
with:
public ActionResult Create(UploadViewItem viewItem, HttpPostedFileBase postedFile)
ASP.NET MVC works with abstractions over the actual HttpContext objects (HttpContextBase, HttpRequestBase, HttpResponseBase, HttpSessionBase, HttpPostedFileBase, ...).
That's what allows for easier unit testing and mocking those objects.
For more information about uploading files in ASP.NET MVC you may checkout the following blog post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With