'Cordova FileTransfer Plugin Got Error "open failed: EACCES (Permission denied)"

I'm using Cordova 11 and trying to transfer document files like pdf or Docx. It's ok with API < 29. But now I always get 'open failed: EACCES (Permission denied)' when trying it on API >= 29 except image or video.

Here is my code:

window.resolveLocalFileSystemURL(fpath, (entry) => {
    let options = new FileUploadOptions();
    options.httpMethod = 'POST';
    options.fileKey = 'file';
    options.fileName = entry.name;
    options.mimeType = entry.type;
    options.params = {
        id: 1
    };
    let fileTransfer = new FileTransfer();
    fileTransfer.upload(entry.nativeURL, 'http://localhost/upload.php', (suc) => {
        console.log(suc)
    }, error => console.log(error), options);
}, error => console.log(error));

Can anyone help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source