Camera API, send fileURI to distant server

Hello everyone ! I’m almost done with my ionic app but i still have a few problems with the cordova camera API.

when the picture is taken, the console.log(imageURI) clearly displays the path to the local storage’s picture.

However, i want to send this picture to a distant server, as a $file input

my controller looks like this :

$scope.getPhoto = function() {

    PhotoService.getPicture().then(function(imageURI) {
        $scope.image = imageURI;
    }, function(err) {

and then, when i try to upload it with other values (title, description, etc…) I use this function :

$scope.create = function (produit) {

    var file = "script.php";
    produit.id_user = $scope.id_user;
    RequestService.fileTransfer(file, $scope.image,values).then(function () { //this part sends to the file script the 2 following attributes, the imageURI and the attributes (title, description, etc...)

        $state.go('app.otherView', {}, {location: 'replace'}); //redirect when sent
            disableBack: true
    }, function () {
        console.log("upload failed");

my problem is, I need to send the $scope.imageURI in a way that the server receives a $file input, but i don’t know how, can someone help ?

Thanks in advance to whoever will answer ! :smiley:

No ideas ? Anyone ? :frowning:

Hi, maybe this helps:

I will try this way of doing it, i’ll keep you updated !