Posts

Showing posts with the label base64

Uploding File using Base-64 in angularJs

We’ll learn how to convert an image/pdf to base 64 in angular js by creating a directive and adding extra parameters for the base 64 data Creating a input of type file in html: <input type="file" id="fileSelector1" class="form-control" name="schemeupload" accept="image/jpeg,image/png,application/pdf" file-model="vm.schemeApply.documents[0]" required/> To accept only image of type jpeg we can use the following in html accept accept="image/jpeg" To accept multiple documents say image files and pdf we can use the accept as accept="image/jpeg,image/png,application/pdf" We will create a directive named file-model to convert the file into base64 "use strict"; (function() { angular.module("SS.pages").directive("fileModel", fileModel); /** @ngInject */ function fileModel($parse, $q) { return { restrict: "A", link: function(scope, ...