hi guys, would you please to see my code here, i’m tryng this but $cordovaFileTransfer.upload do nothing, no succes messege or error, would you guys please tell whats wrong, i have no idea because i’m new in this ionic…thanks
this my code, i’m tryng using somebody tutorial in internet :
$scope.openPhotoLibrary = function() {
//alert(“X”);
var options = {
quality: 85,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
targetWidth: 200,
targetHeight: 200,
};
$cordovaCamera.getPicture(options).then(function(imageData) {
alert("1");
//console.log(imageData);
//console.log(options);
var image = document.getElementById('tempImage');
image.src = imageData;
$scope.imgURI = imageData;
alert("2");
var server = "http://192.168.88.10/upload.php";
alert("3");
filePath = imageData;
alert("4");
var date = new Date();
alert("5");
var options = {
fileKey: "file",
fileName: imageData.substr(imageData.lastIndexOf('/') + 1),
chunkedMode: false,
mimeType: "image/jpg"
};
alert("6");
$cordovaFileTransfer.upload(server, filePath, options).then(function(result) {
alert("Z");
console.log("SUCCESS: " + JSON.stringify(result.response));
console.log('Result_' + result.response[0] + '_ending');
alert("success");
alert(JSON.stringify(result.response));
alert("7");
}, function(err) {
alert("error");
console.log("ERROR: " + JSON.stringify(err));
//alert(JSON.stringify(err));
}, function (progress) {
alert("progress");
// constant progress updates
});
}, function(err) {
// error
console.log(err);
});
}