@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