简体   繁体   中英

Android webview file browser opens but file not selectable

HTML Input type file in my android webview was not working for me so I found this solution ( File Upload in WebView ) and implemented the same, now I am able to open file browser.

But now the problem is I can't select file. Nothing happens on tapping on any file and its shown grayed out as well (like disabled). I've checked on android 5 & 6 both none of them is working for me. Also I have these line in my manifest

<uses-permission 
android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

If someone like to see exact code, I can paste it right here.

Can someone please point out what's wrong with my implementation.

After a long research I found that the accept attribute of file HTML tag was doing all this.

My HTML for input type file tag was like this..

<input type="file" name="file1" id="file1" accept="application/zip,image/png,image/jpg,application/msword,application/pdf,image/jpeg,image/gif,vnd.openxmlformats-officedocument.wordprocessingml.document">

And once I removed the content from accept attribute or removed the accept attribute itself, enable the file selection and it resolved my problem.

<input type="file" name="file1" id="file1" accept="">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM