Like in the title, how I can check if the file input is empty? And bind the result to $scope.
Asked
Active
Viewed 4,616 times
-3
-
actually searching for the answer will net you results. – Takarii May 18 '16 at 08:54
-
Possible duplicate of [Check if a input box is empty](http://stackoverflow.com/questions/16691778/check-if-a-input-box-is-empty) – Takarii May 18 '16 at 08:54
1 Answers
-4
Natively you can't, because file uploading are more complex than that.
In order to trigger and upload of a file you have to use a multipart request which is different from a simple AJAX JSON request.
Of course since angularJS is a very popular framework you have a plugin for this : https://github.com/danialfarid/ng-file-upload. You will find every thing you need :
- How to upload a file
- How to restrict a file (content type, weight, ...).
- It even show some use case about how handling that on server side for Spring/Rails/NodeJS/PHP,...

Walfrat
- 5,363
- 1
- 16
- 35