Question: Hi Im new in angular js and I want to try get the data of my `input type = "file"` in my html.. But when i console it its just said undefined 

html

```
   <input type="file" ng-model="data.img" ng-click="upload()"/>

```

js

```
   $scope.upload = function() {
                console.log($scope.data.img)

            }

```

Answer: 
ng-model does not support for file type input. Need to set the value manually to ngModel using a directive like this 

```
.directive("filesInput", function() {
  return {
    require: "ngModel",
    link: function postLink(scope,elem,attrs,ngModel) {
      elem.on("change", function(e) {
        var files = elem[0].files;
        ngModel.$setViewValue(files);
      })
    }
  }
})

```

call the directive like this 

```
<input type="file" files-input ng-model="data.img" ng-click="upload()"/>

```

now check the console
use `<input type="file" id="file1" name="file1" multiple onchange="angular.element(this).scope().fileNameChanged('file1')"/>` instead of your code,

js

```
 $scope.fileNameChanged = function(inputField) {

var file = document.getElementById(inputField).files;
console.log(file);

```