How to use open file from device and upload using webview


Hi guys,
i am trying to get a file say mp3 to upload using in a webview, but it seem not to open the file manager to sellect a file from device. but if i use it in a web browser it works , How do i do it from webview?


You will have to handle that yourself by implementing your own WebViewClient, you may get enough examples for Android which you may convert to TypeScript / JavaScript.


can I have links to examples
i need it please


Here is a simple example of implementing WebChromeClient. You might have to implement the onShowFileChooser method to get file uploads work.


Thanks For Your Response


But i Need like this in HTML

<input type="file" name="Hello">

that not work to choose file in web view


Did you read the android docs in the given link? It must explain you why & how you need to implement the onShowFileChooser method.


Sorry Thanks For support I didn’t Read it Carefully


I have Problem in implementing

`onShowFileChooser(webView,filePathCallback,fileChooserParams) {

        // this.filepathCallback(filePathCallback);
        return true;

        let context = imagepicker.create({
            mode: "single",
            mediaType: imagepicker.ImagePickerMediaType.Any
        return this.startSelection(context,filePathCallback);

    private startSelection(context,filePathCallback) {
    let abc = context.authorize().then(() => {
                                    return context.present();
            .then((selection) => {
                selection.forEach((selected) => {
                    let path =;
                    let file = fs.File.fromPath(path);
                    this.file_path = file.path;
                    filePathCallback = file.path;
                    return this.file_path;
            }).catch(function (e) {

How Can i set file path or file to return


I have used imagepicker plugin to choose file in android


You will have to pass the selected file path to onReceiveValue method.


Thank you For Your Help

Two major things has been done one is File Upload and Second Cookie Setting

as i Have read that ios support file upload so is there any need to implement it.

this.file_path = "file://" + this.file_path;
let results = Array.create(, 1);
results[0] =;


I haven’t tried personally but I guess iOS WebView works with file upload by default.