Vinod K
Vinod K

Reputation: 148

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.

Upvotes: 0

Views: 1598

Answers (1)

Vinod K
Vinod K

Reputation: 148

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="">

Upvotes: 1

Related Questions