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