Upload video files with angularJS

0

I have a page where I load the image files, pdf, xml, etc. On this page, I now need to upload video files too, I have researched some sites but I have not found examples of how to do it, when I try to upload an error is returned at the console because the file is very large (52Mb). Does anybody know how to solve this ? In backEnd I'm using C #

    
asked by anonymous 18.07.2018 / 16:02

1 answer

0

Our friend, using angularJS 2018, but anyway, come on, I'm also on a project that uses angularJS ahahah

Try using HTML5

<input type="file" id="file" name="file"/>
<button ng-click="add()">Adicionar</button>

On your controller, define the method: add

$scope.add = function() {
    var f = document.getElementById('file').files[0],
        r = new FileReader();

    r.onloadend = function(e) {
      var data = e.target.result;
      //envie seus dados binários via $http ou $resource ou faça qualquer outra coisa com ele
    }

    r.readAsBinaryString(f);}

You can also get a better reference on this SITE

    
18.07.2018 / 16:37