Does Ajax.BeginForm Support File Uploading?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Does Ajax.BeginForm Support File Uploading?



I use HttpPostedFileBase as model for the file, but the files comes
Null to the controller, I want to use the AjaxForm tha Asp.net provides not the regular BeginForm i need to post this throw ajax ?


@using (Ajax.BeginForm("UploadImg", "Controller", Object,
new AjaxOptions HttpMethod ="Post", OnComplete = "Something();" ,
new enctype = "multipart/form-data" ))

@Html.AntiForgeryToken()

<div class="form-horizontal">

@Html.ValidationSummary(true, "", new @class = "text-danger" )

<div class="form-group">

<div class="col-lg-7">
@Html.TextBoxFor(model => model.File, new type = "file", @class = "form-control", required = "required" )

<input type="submit" value="Upload" class="btn-primary" />


</div>
</div>
</div>





show us your controller also
– AlexiAmni
Aug 6 at 9:00





Ajax.Beginform is just a helper function that writes a HTML <form> into the markup, so it supports everything that a <form> supports
– Liam
Aug 6 at 9:01


<form>


<form>





Possible duplicate of MVC 4 Razor File Upload
– Liam
Aug 6 at 9:02









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS