0

I try to upload file directly to an Image field.

When i try my dev on the browser, everything works fine (http://127.0.0.1:8100/ionic-lab). The file upload correctly.

When i try on my android phone, I got a 403 Fordidden error

I enable the file upload Service in the settings file. I add in the file persmissions.xml the following :

`<?xml version="1.0" encoding="UTF-8"?>
<permissions>
    <allow type="service" action="upload" resource="upload" groupName="Admin" groupID="01000000000000000000000000000000" temporaryForcePermissions="false"/>
</permissions>`

My code is the following :

var file = document.getElementById('fileInput').files[0];
$scope.book.Image.$upload(file).$promise.then(function (e) {
    $scope.book.$save();
});

1 Answers1

2

It could come from a CORS problem. So try to add these lines in the config.xml file:

<access origin="*"/> 
<allow-intent href="*"/>
<allow-navigation href="*"/>

If it is not working, try to restore the state of your mobile application. to do that, go into the mobile folder of your project and execute this line ionic state restore.

If this command line fail. Erase the platforms folder in your mobile folder and execute ionic state restore another time.

I hope that will help you.