Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49166

When select file size return 0 on cordova (ionic 1 & angular 1)

$
0
0

@onursimsek94 wrote:

I'm developing mobile app using cordova, ionic 1 and angular 1. I choose file in my application with input file type, but file size sometimes return 0. How can i fix this problem.

Step 1: I choose file with input[type=“file”] from Google drive, Dropbox or iCloud.

<input type="file" id="fileInput" class=“fileInput"/>

Step 2: I'm converting file to base64 string. (Actually my problem is here. As i said, file size sometimes return 0. But just sometimes) (event.target.files[0].size)

angular.element('#fileInput').on('change', function (event) {
   var reader = new FileReader();

   reader.onload = function (readerEvt) {
      var binaryString = readerEvt.target.result;
      $scope.base64FileData = btoa(binaryString);
   }

   reader.readAsBinaryString(event.target.files[0]);
}

Step 3: I'm sending Base64 string to other users with XMPP.

I'm waiting for your help. Thanks in advance...

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49166

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>