相关疑难解决方法(0)

WebView中的文件上载

自从过去几天以来,我一直在努力从WebView上传文件,但没有任何进展.我用谷歌搜索并实现了所有建议的解决方案,但都没有,例如:此处建议的解决方案,等等.

问题:我有一个带有以下代码的HTML页面来上传文件.它在Firefox等桌面浏览器和模拟器/ AVD的内置浏览器中工作正常,当我点击元素呈现的"浏览..."按钮时,浏览器会打开一个对话框,我可以在其中选择要上传的文件.

但是,在android 3.0模拟器/ AVD中,当我点击"选择文件"时,没有任何反应,没有打开文件对话框!

<form method="POST" enctype="multipart/form-data">
File to upload: <input type="file" name="uploadfile">&nbsp;&nbsp;
<input type="submit" value="Press to Upload..."> to upload the file!
</form>
Run Code Online (Sandbox Code Playgroud)

有人可以最早建议一个可能的解决方案.

android webview android-emulator

156
推荐指数
15
解决办法
19万
查看次数

WebView Android 4.0文件上传

它只是不工作.

我这样做

webView.setWebChromeClient(new WebChromeClient() {

        public void openFileChooser(ValueCallback<Uri> uploadFile) {
            System.out.println("openFileChooser");
            mUploadMessage = uploadFile;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("file/*");
            PresentationActivity.this.startActivityForResult(
                    Intent.createChooser(i, "Image Browser"),
                    FILECHOOSER_RESULTCODE);
        }
    });
Run Code Online (Sandbox Code Playgroud)

但是从不调用openFileChooser.有任何想法吗?openFileChooser在Android源代码中标记为@hide.我认为这是因为你不应该使用这种方法.还有另一种可能性来打开fileChooser吗?

html upload android file

6
推荐指数
1
解决办法
2843
查看次数

标签 统计

android ×2

android-emulator ×1

file ×1

html ×1

upload ×1

webview ×1