1
我想輸入圖像並將其上傳到本地機器上的文件夾。ng-file-upload不起作用
HTML:
<md-input-container class="md-block" flex-gt-sm>
<h4>Image</h4>
<input type="file" ng-model="post.primaryImage" />
</md-input-container>
控制器:
var url = '/Users/my.name/Desktop/images'
$scope.OnSubmit = function() {
//ResourceService.addMachine.save($scope.post);
console.log($scope.post);
$scope.upload(file);
}
$scope.upload = function (file) {
Upload.upload({
url: 'url',
data: {file: file}
}).then(function (resp) {
console.log('Success ' + resp.data);
});
}
逸岸的圖像是沒有得到輸入。 當我打印scope.post控制檯上打印一個空白對象。 我已經閱讀了關於這個主題的幾個答案,但是關於如何上傳本地系統文件夾中的圖像沒有任何回答的問題。
非常感謝。圖像正在獲取輸入。唯一的問題是它不會上傳到「/Users/my.name/Desktop/images」。 localhost:8888/Users/my.name/Desktop/images 404(Not Found)。我想要我的系統上的圖像。我應該提及哪些網址。 – MasterMind