1

Hi I want to send the file data using ng-model for the input file type along with other fields

<div class="container">
    <h1>user detail</h1>

    <form novalidate="novalidate" class="form-horizontal">
        <div class="control-group">
            <label class="control-label" for="inputFirstName">First name:</label>

            <div class="controls">
                <input type="text" id="inputFirstName" ng-model="user.firstName"/>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputLastName">Last name:</label>

            <div class="controls">
                <input type="text" id="inputLastName" ng-model="user.lastName"/>
            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <input type="file" ng-model="user.image" id="inputimage"></input>

            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <a ng-click="cancel()" class="btn btn-small">cancel</a>
                <a ng-click="updateuser()" class="btn btn-small btn-primary">Update user</a>
            </div>
        </div>
    </form>
</div>

In controller i am getting the data using $scope.user. I am getting the data in the first name and last name fields but i am not getting data in the image field.

How do i get the file name that was uploaded.

Praveen Reddy
  • 217
  • 1
  • 4
  • 11
  • 1
    `type="file"` work differently,if you want the content of file?? – Arpit Srivastava Sep 05 '14 at 06:50
  • Basically i want upload the images. I want to know the full file path. – Praveen Reddy Sep 05 '14 at 06:53
  • http://stackoverflow.com/questions/17063000/ng-model-for-input-type-file – Rickard Staaf Sep 05 '14 at 09:57
  • @ Rickard I have seen the link. My controller code is $scope.updateuser = function () { UpdateuserFactory.update($scope.user, function(response){ $location.path('/user-list'); }); }; I am getting the firstname and lastname field values. How can get the filename and content of the file. – Praveen Reddy Sep 05 '14 at 11:22

0 Answers0