Cordoba android input file: cannot access some directories on the device

My Cordoba-based application allows users to upload images and PDFs to a server. I am using <input type="file">Dropzone.js simple plugin for layout and transport. It works great for both iOS and Android. After clicking the button starts the file manager, you can select the file and download it.

The problem is that on Android, the user cannot select files from directories at the top of the file selector. I have an LG G4, so I can’t choose from the latest files, Google Drive, images uploaded, internal memory. I can choose from gallery, photos and file manager without any problems, but not for any directories above the line.

I have permissions to read external storage. What am I missing here?

Here is the screen from the tester: Tester Shape Screen

Dropzone html, its basic how it gets. Dropzone does not add input type = file here, but, like jQuery, does it on the fly when a file is selected.

<form action="file-upload" class="dropzone dropzone-form dz-clickable" rem="dropform" id="dropzone-form">
            <input type="hidden" name="userId" value.bind="user_id" class="au-target" au-target-id="164">
            <div class="text-center add_btn_wrapper">
                <a class="btn btn-default btn-md dz-clickable" rem="dropbutton">Select file</a>
            </div>
            <div class="dz-default dz-message">
                <span>Upload your scans</span>
            </div>
    </form>

Dropzone js declaration (I use Aurelia.js (es5 / 6) as an interface):

this.zone = new Dropzone(
    _this.element.querySelector("[rem='dropform']"), { 
        url: this.auth.config.baseUrl + "../_uploader/file/upload",
        maxFiles: this.max_files,
        acceptedFiles: this.accepted_files,
        clickable: [_this.element.querySelector("[rem='dropbutton']"), _this.element.querySelector("[rem='dropform']")],
        dictDefaultMessage: this.label,
        addRemoveLinks: this.allow_remove,
        removedfile: (file) => { .... },
        init: function() {
            this.on("addedfile", (fx) => { .... });
            this.on("complete", (fx) => { .... });
        }
    });

And in AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
+4
source share
1 answer

Well, the problem was caused by the acceptFiles parameter. For the desktop, I had it there "image/*,.pdf", and it worked, but the cordova with this value got confused and limited my access. For mobile devices, I only use it now "image/*", and it works as it should.

+1
source

All Articles