i know that there is a lot of questions like this, but i read them all and null of them solved my problem. Here below im going to show the code that i have in my view and my controller so that you can have an idea of my code.
View :
<td><% using (Html.BeginForm("Index", "Home", FormMethod.Post, new {enctype = "multipart/form-data"})) { %>
<%: Html.ValidationSummary(true) %>
<div id="section1">
<div class="editor-label">
<%: Html.LabelFor(model => model.Name) %>
</div>
<label for="file">Filename:</label>
<input type="file" name="myfile" id="File5" value="Choose File Banner1" />
<p> </p>
And here is my controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(HomeModel model, string submitButton, HttpPostedFileBase myfile)
{
I cant figure out what mite be the problem.. can someone help me please
I also had the same problem and I ended up here while looking for an answer. I had forgotten the enctype parameter in the form definition
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
// form
}
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