@sioesi wrote:
I'm trying to upload my server an image from the gallery on the device. My code works fine when I take a new photo with your phone and upload. But when I select not working. The URL is incorrect or invalid. However I do not get error when I try uploading this. I'll let my code
$scope.getPicture = function(){ var options = { quality: 75, destinationType: Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.PHOTOLIBRARY, popoverOptions: CameraPopoverOptions, correctOrientation: true, targetWidth: 720 }; Camera.getPicture(options).then(function(imageURI) { $scope.photo = imageURI; $scope.nueva_foto = imageURI; $scope.mostrar_form = true; }, function(err) { // error }); }; var trustAllHosts = true; var ftOptions = new FileUploadOptions(); ftOptions.fileKey = 'file'; ftOptions.fileName = $scope.photo.substr($scope.photo.lastIndexOf('/') + 1); ftOptions.mimeType = 'image/jpeg'; ftOptions.chunkedMode = false; ftOptions.httpMethod = 'POST'; if(ionic.Platform.isAndroid()){ $cordovaFileTransfer.upload(encodeURI(server),$scope.photo,ftOptions) .then(function(result) { }
The example URL I get is: image%3A43
Posts: 23
Participants: 2