Hi, I’m writing an app (using Ionic 2) that uploads pictures to my ownCloud server via Webdav. Here is the relevant part of my code:
upload(imgToUpload) {
let transfer = new Transfer();
let URL: "https://username:password@owncloud.../remote.php/webdav/folder/"
let options = {
httpMethod: "PUT"
}
transfer.upload(imgToUpload, URL, options, true).then(
(succ) => {},
(err) => {console.log(err.http_status+" "+err.body);}
I’m using the Ionic File Transfer Plugin which internally uses a PUT request. The whole thing works on Android, but on iOS I get the following error:
401 <?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>Cannot authenticate over ajax calls</s:message>
</d:error>
I’m using basic authentication. I looked through the ownCloud source code and it seems that the error originates here but I don’t see why it’s thrown or why this only happens on iOS.
Can anyone help me get this sorted out?
Thanks in advance!