我正在努力实现以下目标:
我似乎无法让这个工作。我尝试使用multer无济于事。
到目前为止,我有以下内容:
HTML
<form name="register" enctype="multipart/form-data" method="post" ng-submit="registerSubmit(user)">
<input type="email" placeholder="Email" ng-model="user.email" />
<input type="file" id="cv" name="cv" ng-model="user.cv" />
<button type="submit"></button>
</form>
角
app.controller("MainController", function($scope, $http){
$scope.registerSubmit = function(user){
$http.post("/api/register", user).success(function(data){
console.log(data);
});
});
});
节点(使用Express和其他模块配置)
app.use("/api", router);
router.post("/api/register", function(req, res){
//file not coming through and not sure what to do with it here anyway!
});