问题:
Here is my HTML form:这是我的 HTML 表单:
<form name="myForm" ng-submit="">
<input ng-model='file' type="file"/>
<input type="submit" value='Submit'/>
</form>
I want to upload an image from local machine and want to read the content of the uploaded file.我想从本地机器上传图像并想读取上传文件的内容。 All this I want to do using AngularJS.所有这些我都想使用 AngularJS 来完成。
When I try to print the value of $scope.file
it comes as undefined.当我尝试打印$scope.file
的值时,它是未定义的。
解决方案:
参考一: https://stackoom.com/question/1FvAH参考二: File Upload using AngularJS