0

HTML Code

<input type="file" file-model="vm.myFile" />
<button data-ng-click="vm.uploadFile($files)" ng-file-select ng-file-change="vm.uploadFile($files)">upload me</button>

AngularJS Code

vm.uploadFile = function ($files) {
alert($files);
};

1 Answer 1

1

$files is an array of files, you will have to traverse through it, if you have only a single file, you can do $files[0].name

Sign up to request clarification or add additional context in comments.

4 Comments

Sorry not working, Could you please re write the code
do you get anything in $files ? can you create a plunker or fiddle?
the fiddle needs to have the proper angular code, it won't work
you haven't linked angular and your angularFileUpload module in the js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.