0 Replies Latest reply on Jan 3, 2017 11:13 PM by venkatzeus

    Upload file from jive Apps using .NET API Service



      I have a Angular JS file, in which I have added a custom file upload control. I am trying to upload the image from  jive using .NET  API service. I tried the below code, but I am getting error as "Undefined".


      In the Index.html file:


      <input type="file" class="form-control" id="imageUploadfile" name="imageUploadfile" file-model="myFile" accept="image/*" />

        <input type="button" name="imageUploadButton" ng-click="uploadFiles()" value="Upload" />


      In the controller.js


      $scope.uploadFiles = function () {
              var f = document.getElementById('imageUploadfile').files[0],
           r = new FileReader();
          r.onloadend = function (e) {
              var data = e.target.result;
          var test = r.readAsArrayBuffer(f);
              testAPIService.postUploadImage(test).success(function (response) {
                  var imageurl = _testBaseUrl + 'Images/' + response.filePath.split(/(\\|\/)/g).pop();
              $scope.testTypeImage_url = imageurl;
          }).error(function (response) {


      In the service.js


      testAPIService.postUploadImage = function (formdata) {
              var request = {
                  url: urlBase + 'UploadImage',
                  method: 'POST',
                  data: formdata,
                  headers: {
                      'Content-Type': undefined
              return $http(request);


      I am getting the error as "undefined". I am using IE 11.


      How to upload file from Jive using Angular Js and .NET API service?