Ich habe ein Ionic Framework, wo ich das FileTransser-Modul geladen habe, damit ich ein Bild aufnehmen und hochladen kann. Der Teil "Fotografieren" funktioniert perfekt.ionic FileTransfer gibt kein Ergebnis/Fehler/Feedback, und dann tut die Erfolgsfunktion
Wenn ich auf das Bild klicke, um es hochzuladen, feuert es das Overlay "Busy uploading", dann wird es ausgeblendet und es wird die unvollständige Funktion ausgeführt.
Das Problem ist, dass der eigentliche Upload-Teil nichts tut. Keine Fehler, keine Notizen, nichts in meinen Logs, keine tatsächliche XHR resouce (oder irgendeine Ressource). Dies macht es ziemlich schwierig zu debuggen. Könnte mir jemand einen Stoß in die richtige Richtung geben?
Ps: Ich tue dies auf meinem Android, mit Chrome debugconsole
$scope.takePicture = function() {
var options = {
quality: 90,
destinationType: Camera.DestinationType.FILE_URL,
sourceType: Camera.PictureSourceType.CAMERA
};
$cordovaCamera.getPicture(options).then(
function(imageData) {
$scope.picData = imageData;
$scope.ftLoad = true;
//~ $localStorage.setItem('fotoUp', imageData);
//~ $localStorage.fotoUp = imageData;
$ionicLoading.show({template: 'Loading picture...', duration:500});
},
function(err){
$ionicLoading.show({template: 'Error loading...', duration:500});
}
)
}
//--------------------------
// Upload the photo
$scope.uploadPicture = function() {
$scope.upload = {};
$ionicLoading.show({template: 'Bezig met uploaden...'});
var fileURL = $scope.picData;
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
options.chunkedMode = true;
var ft = new FileTransfer();
ft.upload(fileURL, "https://www.example.com/recieve_photos.php", viewUploadedPictures, function(error) {
$ionicLoading.show({template: 'connection error...'});
$ionicLoading.hide();
}, options);
}
var viewUploadedPictures = function($) {
$ionicLoading.show({template: 'Get uploaded pictures...'});
$http.get('https://www.example.com/recieve_photos.php')
.then(function (response){
$scope.upload.result = response.data
}).catch(function(error){
$scope.error = error;
});
$ionicLoading.hide();
}