0

Using this solution I'm able to retrieve files from the input tag in base64 encoding via a directive:

.directive("fileread", [function () {
    return {
        scope: {
            fileread: "="
        },
        link: function (scope, element, attributes) {
            element.bind("change", function (changeEvent) {
                var reader = new FileReader();
                reader.onload = function (loadEvent) {
                    scope.$apply(function () {
                        scope.fileread = loadEvent.target.result;
                    });
                };
                reader.readAsDataURL(changeEvent.target.files[0]);
            });
        }
    }
}])

The readAsDataURL will read the file as base64.

How is it possible to get the path to the selected file from the input tag? e.g. file:///....

Community
  • 1
  • 1
Clawish
  • 2,934
  • 3
  • 24
  • 28

0 Answers0