Javascript angular和mvc 4将文件发布到服务器
我有这样一个代码: JavascriptJavascript angular和mvc 4将文件发布到服务器,javascript,c#,angularjs,razor,Javascript,C#,Angularjs,Razor,我有这样一个代码: Javascript $scope.saveChanges = function (bl) { console.log(bl) $http.post('@Url.Action("SaveChangesBudgetLine", "FinancialPlanning")', { amount: bl.Amount, month: bl.Month.id_bulan,
$scope.saveChanges = function (bl) {
console.log(bl)
$http.post('@Url.Action("SaveChangesBudgetLine", "FinancialPlanning")', {
amount: bl.Amount,
month: bl.Month.id_bulan,
year: bl.Year,
newFile : bl.newFile
})
.then(function (resp) {
console.log(resp)
})
}
c#:
javascript中的newFile
具有如下值(客户端上的console.log):
但在服务器上,newFile为null
为什么会这样?如何解决这个案子?谢谢
[HttpPost]
public ActionResult SaveChangesBudgetLine(String amount, int month, int year, HttpPostedFileBase newFile)
{
return Json(new { is_success = true, amount = amount, month = month, year = year, newFile = newFile });
}
newFile: File
lastModified: 1440754532970
lastModifiedDate: Fri Aug 28 2015 16:35:32 GMT+0700 (SE Asia Standard Time)
name: "External.xlsx"
size: 964223
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
webkitRelativePath: ""