javascript - angular and mvc 4 post File to server -
i have code :
javascript
$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# :
[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
in javascript has value (console.log on client) :
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: ""
but on server newfile null.
why happend? how solve case? thanks
Comments
Post a Comment