Upload video files with Angularjs

Asked

Viewed 24 times

0

I have a page where I upload the image files, pdf, xml, etc. On this page, I now need to upload video files too, I searched on some sites but I did not find examples of how to do, when I try to upload an error is returned in the console, because the file is very large (52Mb). Does anyone know how to solve this ? In backend I’m using C#

1 answer

0

Our friend, 2018 using Angularjs, but anyway, come on, I’m also in a project that uses Angularjs ahahah

Try to use HTML5

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

In your controller, set 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 may also have a better reference in this WEBSITE

Browser other questions tagged

You are not signed in. Login or sign up in order to post.