Styler2go
Styler2go

Reputation: 603

Input File on Android WebView

is there any way to simply open the Default File Explorer to choose a file if someone clicks on an input[type=file] in a WebView?

Upvotes: 2

Views: 1346

Answers (2)

Simon MacDonald
Simon MacDonald

Reputation: 23273

Not to my knowledge. I'd love to see a dialog that takes advantage of the PhoneGap File API's that would allow you to graphically select a file but no one has done it to my knowledge.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006869

Since there is no "default file explorer" in Android, you are at the mercy of whatever the implementer of the browser did. In the case of WebView, I am not certain what it will do by default, perhaps nothing.

I am no DOM/JS expert, but I would think that you could modify things such that an onClick event on the <input type="file"> would call into Java code that you inject via addJavascriptInterface(), at which point you can bring up whatever sort of "file explorer" you want.

Upvotes: 2

Related Questions