File upload with ajax in asp.net mvc

前端 未结 4 1333
遇见更好的自我
遇见更好的自我 2020-12-22 01:23

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

4条回答
  •  情话喂你
    2020-12-22 01:56

    Try this code

    //Add reference to form.js

    
    
    @using (Html.BeginForm("Create", "Company", FormMethod.Post, new { @enctype ="multipart/form-data",@id="formid" }))
    {
    
    }
    
    //Javascript code
    
    
    

    This will work as ajax submit.

    //You can get more details on AjaxForm here

提交回复
热议问题