What is wrong in here?
The ajax call is not reaching the action
Server side:
[HttpPost]
public ActionResult UploadFile(long someID, HttpPostedFileBase myFile)
{
return "hello";
}
Client side html:
<form id="my-form" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="someID" value="156" />
<input type="file" name="myFile" />
</form>
Client side javascript:
$.ajax({
async: true,
type: 'POST',
url: '/MyController/UploadFile/',
data: new FormData($('#my-form')),
success: function (data) {},
cache: false,
contentType: false,
processData: false
});
This kind of upload via ajax should be possible in some browsers.
I'm getting this serverside error: The parameters dictionary contains a null entry for parameter 'someID' of non-nullable type 'System.Int64' (...)
If I change the action to UploadFile(), with no parameters, the ajax call enters the action, but then how do I recover the posted data?