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

CameraCapture & cordovaFileTransfer not working in Android 3.2

$
0
0

@Teravito wrote:

Hello I'm having some troubles with Android uploading photos from the gallery to my server, the code works in iOS (Camera & Library) but in Android only the Camera works fine.

Am I doing something wrong?

$scope.newObjectPhotoLibrary = function(relationIndex)
{
if (!isMaxNumbOfObjects())
{
var options = {
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
quality: 50,
allowEdit: true,
targetWidth: 350,
targetHeight: 350,
maximumImagesCount: 1
};
$cordovaCamera.getPicture(options).then(function(imageData) {
var name = imageData.substr(imageData.lastIndexOf('/') + 1);
var canonicalName = $rootScope.replaceDots(name);
var object = {value: canonicalName, type:"image", path: imageData};
pushObjectToRelation(object, relationIndex);
}, function(err) {
$ionicPopup.alert({
title: 'Error',
content: 'There was an error loading the image'
});
});
}
}

var options = {
fileKey: object.value,
fileName: object.path.substr(object.path.lastIndexOf('/') + 1),
chunkedMode: false,
};
// console.log(options);
$cordovaFileTransfer.upload(url, object.path, options)
.then(function(result) {
service.getUser()
.then(function(jsonData)
{ // success
deferred.resolve(data);
}, function(jsonData)
{ // error

	deferred.reject(data);
});

}, function(err) {
// console.log(JSON.stringify(err));
deferred.reject(err);
}, function (progress) {

});

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49177

Trending Articles



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