三星、华为等android里webview不支持input file的解决方法
原文地址:http://camnpr.com/archives/1093.html
由于安全因素android webview屏蔽了文件上传控件,但是他并没有完全封掉。
[html] view plain copy
- <form method="POST" enctype="multipart/form-data">
- File to upload: <input type="file" name="uploadfile">
- <input type="submit" value="Press to Upload..."> to upload the file!
- </form>
1.activity定义
[java] view plain copy
- private ValueCallback mUploadMessage;
- private final static int FILECHOOSER_RESULTCODE = 1;
2.扩展WebChromeClient
[java] view plain copy
- WebChromeClient chromeClient = new WebChromeClientImpl();
- webView.setWebChromeClient(chromeClient);
3.实现WebChromeClientImpl类
[java]