I know this has been discussed a lot of times.
I basically want the possibility in my view to update a file. This file has to be mapped to the model the controller e
I think you cannot upload files with AJAX. One way to achieve this is to use a hidden iframe. Try this jQuery Form plugin and Telerik file control
Please refer this link also.
Try this code
//Add reference to form.js
<script src="http://malsup.github.com/jquery.form.js"></script>
@using (Html.BeginForm("Create", "Company", FormMethod.Post, new { @enctype ="multipart/form-data",@id="formid" }))
{
}
//Javascript code
<script type="text/javascript">
$('#formid').ajaxForm(function (data) {
});
</script>
This will work as ajax submit.
//You can get more details on AjaxForm here
I have made it based on this answer from Demian Flavius: How to do a ASP.NET MVC Ajax form post with multipart/form-data?
Basically it's the new JavaScript's FormData object that makes it easy for uploading with ajax as in the article your mentioned.
Please try this one @using (Html.BeginForm("Create", "Company", FormMethod.Post, new { id = "ym-form", enctype="multipart/form-data" }))