Uploading PDF file

1

I need to upload pdf files with angular js.

I have field one for the user to input a file, however how do I send this file to the back end and save it to some folder?

    
asked by anonymous 08.03.2018 / 20:27

1 answer

0

Basically, you need to recover the base64 from the selected file in <input> , and send it to your server using $http.post .

Basically I learned by seeing this component published in github,

visit link

With it you would only need to have <input> as follows

<input type="file" ng-file-model="testFile" />

In Test would be its angular variable in scope.

In ngController you would access base64 in the following way:

var base64 = $scope.testFile.Data

This Data is generated by the component that sent you the link, now just send the

base64 to your server.

    
08.03.2018 / 20:55