I am doing a file upload and my code is correct for the upload.
This example is pretty much exactly what I am doing: https://stackoverflow.com/a/15680783/5874935
HOWEVER, something has happened with my project and it has suddenly stopped working. I have worked and worked with no avail to fix the issue. I recently converted to a single page application using this function to submit a form:
 var ajaxFormSubmit = function (contentDiv, formDiv, modalId, formId, controllerPath) {
         $(".loader").show();
         $("#".concat(formId)).on("submit", function (e) {
             console.log("ajax form submitted");
             e.preventDefault();  // prevent standard form submission
             var form = $(this);
             $.ajax({
                 url: form.attr("action"),
                 method: form.attr("method"),  // post
                 data: form.serialize(),
                 error: function () {
                     $(".loader").hide();
                     alert("An error occurred.");
                 },
                 success: function (partialResult) {
                     console.log(partialResult.length);
                     if (partialResult.length === 0) {
                         console.log("form archhived");
                         $("#".concat(modalId)).modal('hide');
                         //forcing the backdrop to go away, something is wrong with the modal, it needs work.
                         $('.modal-backdrop').remove();
                         getManager(controllerPath, contentDiv);
                         //get gunnery manager
                     }
                     else {
                         console.log("form came back");
                         $("#".concat(formDiv)).html(partialResult);
                         $(".loader").hide();
                     }
                 }
             });
         });
     }
model:
public class person 
{
public int id {get;set;}
public string fName {get;set;}
public string lName {get;set;}
public HttpPostedFileBase attachment {get;set;}
}
here is my controller portion:
if (model.attachment != null)
                {
                    var file = model.attachment;
                        if (file.ContentLength > 0)
                        {
                            var path = Path.Combine(Server.MapPath("~/App_Data/uploads"),Path.GetFileName(file.FileName));
                        file.SaveAs(path);
                        System.Diagnostics.Debug.WriteLine(path);
                        model.attachmentLink = path;
                    }
            }
I find it no conincidence that my file upload stopped working around this time, but I just now noticed. How do I make my file upload work?
NOTE The view is very standard using html helpers.
 
     
    