使用 AngularJS 上传文件 - File Upload using AngularJS

问题:

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章