Join the Stack Overflow Community
Stack Overflow is a community of 6.8 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I use input type="file" to make form input. I had no constraints in insert but I have a problem in edit or update data. To get data from files that are already input. Showing filenameif I click button edit. Can you help me ? How to get filename and show in side input type file ? Thanks.

This is my input type="file"

<div class="form-group">
<label class="control-label col-md-3">Image</label>
<div class="col-md-6">
<input type="file" name="file" file-model="userfile">
</div>
</div>

This is my directives

app.directive('fileModel', ['$parse', function ($parse) {
    return {
    restrict: 'A',
    link: function(scope, element, attrs) {
        var model = $parse(attrs.fileModel);
        var modelSetter = model.assign;

        element.bind('change', function(){
            scope.$apply(function(){
                modelSetter(scope, element[0].files[0].name);
            });
        });
    }
   };
}]);
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.