I have HTML page and I call web api to upload file. My client side code is:
<input name="file" type="file" id="load-image" />
<script>
...
var data = new FormData();
var files = $("#load-image").get(0).files;
data.append("UploadedImage", files[0]);
var ajaxRequest = $.ajax({
          type: "POST",
          url: "/UploadImage",
          contentType: false,
          processData: false,
          data: data
 });
And server side code:
public class FileUploadController : ApiController
{
 [HttpPost]
 public void UploadImage()
 {
   if (HttpContext.Current.Request.Files.AllKeys.Any())...
It works. Now I would like to do the same in MVC project. I have client side code the same, but server side code is little different.
Base class of controller is Controller(not api controller) and when I try this:
public class FileUploadController : ApiController
    [HttpPost]
    public void UploadImage()
    {
if (HttpContext.Current.Request.Files.AllKeys.Any())
I get error that 'System.Web.HttpContextBase' does not contain a definition for 'Current'...
What should I change in MVC that file upload will work the same as in webApi? Client side code is the same?
 
     
    