javascript - Form input file does not take effect in hybrid development (on Android)

WBOY
Release: 2016-08-04 09:21:12
Original
1333 people have browsed it

Hybrid development uses PHP as the backend, and adds to the front page. It can be displayed, but the file cannot be selected. This function is to upload pictures and return data.

Reply content:

Hybrid development uses PHP as the backend, and adds to the front page. It can be displayed, but the file cannot be selected. This function is to upload pictures and return data.

What browser are you using? This should be fine

Rewrite WebChromeClient and add a method to it:
public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture)

<code>    {
        mUploadMessage = uploadMsg;
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("image/*");
        startActivityForResult(Intent.createChooser(intent, "选择图片"), FILECHOOSER_RESULTCODE);
    }</code>
Copy after login



Call the camera directly
Call camera pictures or albums

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!