Android webview input type file

后端 未结 3 1005
走了就别回头了
走了就别回头了 2021-01-03 03:05

I\'m trying to build web project using android, from webview. I have a input field of type file to let user upload files to server,

3条回答
  •  醉酒成梦
    2021-01-03 03:27

    Try implementing the file Chooser method like this, as mentioned in the article link provided at the end:

    webView.setWebChromeClient(new WebChromeClient() {
    
       // openFileChooser for Android 3.0+
    
        public void openFileChooser(ValueCallback uploadMsg, String acceptType){ 
    
         // Update message
         mUploadMessage = uploadMsg;
    
         try{  
             // do work....
    
         }catch(Exception e){
    
              Toast.makeText(getBaseContext(), "Exception:"+e,
              Toast.LENGTH_LONG).show();
         }
    }
    

    View Details Here

提交回复
热议问题