First of all I am new in MVC. And I am working on file Upload part which is all together not passing control from Ajax Js call to controller itself. Below is the code: View from Dialog.cshtml
Upload your customized Microsoft Word Document as a confirmation letterFrom Model.js
function uploadConfirm(summary, data) {
clearErrorMessage();
return $.ajax({
type: "post",
url: "/Confirmation/Upload?",
processData: false,
contentType: false,
data: data
}).success(
function getSucceeded(data) {
summary.confirmationID(data);
refreshSummary(summary);
}).fail(onAjaxError);
}
Now this should call Upload function in my controller. The code of Upload as below From ConfirmationController.cs
[HttpPost]
[SharePointContextFilter]
public ActionResult Upload(Guid id, HttpPostedFileBase doc)
{
string extension = Path.GetExtension(doc.FileName);
if (extension == null || !extension.StartsWith(".doc", StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException("Unsupported doc type. Only .dox or .docx files are acceptable.");
}
return Generate(id, null, null, doc.InputStream);
}
Now when I am putting debugger in my Model.js file it should debug me to Controller Upload function. But after moving from jquery file it just comes back in success part saying "An unexpected error occurred please contact admin" Can some one help me in understanding this.