Don Thomas Boyle
Don Thomas Boyle

Reputation: 3045

KendoUI Upload Control not posting correctly

Using VS'12 KendoUI - C# asp.net MVC EF Code First Internet Application Template

enter image description here

My Question is simple , how do i Post both of them to my Controller at once?

here is a little example of my code ( the 2 buttons )

<div>    
     <p>
        <input type="submit" value="Upload" id="do" class="k-button"/>
    </p>
</div>

@(Html.Kendo().Upload()
        .Name("attachments")
        .Async(async => async
            .Save("Index", "ImageUpload")
            .AutoUpload(false)
        )
)

Upvotes: 1

Views: 2763

Answers (1)

Brett
Brett

Reputation: 4269

You configured your upload control to upload files asynchronously; therefore, it doesn't POST with the form. If you want both your form data and your files to POST at the same time to the same controller, then you need to configure your upload control to be synchronous, not Async, and you need to add enctype="multipart/form-data" to the <form/> tag. Then in your MVC controller, make sure one of your parameters is IEnumerable<HttpPostedFileBase> attachments along with your form data model parameter(s).

Upvotes: 2

Related Questions