I've trying to send a file through Ajax.beginForm with enctype = "multipart/form-data", but I always get it as null,
I'm returning a JavaScriptResult from My controller like this,
public JavaScriptResult SaveFile(MyModel model)
{
JavaScriptResult result = new JavaScriptResult();
result.Script = "$('#ShowPopup').trigger('click')";
return result;
}
When using Html.BeginForm it works great, but when it returns the result, it shows the following on the browser,

I don't know what's wrong with Html.BeginForm(), also when I'm returning a view, the view returns but without the my _Layout.cshtml page, breaks my design,
so the problem is when I use ajax it perfectly great but doesn't post file, and when I'm using html.beginForm, it posts the file, but breaks the design after return.
MyModelcontains??FormDataas shown in this example. And then you can just call"$('#ShowPopup').trigger('click')";in the success callback rather than trying to return a script.