色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

android - 安卓開發webview無法運行<input type="file"怎么破?

瀏覽:74日期:2024-03-02 14:32:10

問題描述

求解!安卓webview無法運行<input type='file' name='file' /> 標簽!HTML完整代碼:<html><body>

<form action='upload_file.php' method='post'enctype='multipart/form-data'><label for='file'>Filename:</label><input type='file' name='file' /> <input type='submit' name='submit' value='Submit' /></form>

</body></html>在線等!??!

問題解答

回答1:

這個已經有人問過了,我已經回答過了,親測完全沒問題。https://segmentfault.com/q/1010000005980836

回答2:

Github上有個Os-FileUp項目提供了一些方法.

webView.setWebChromeClient(new WebChromeClient(){ //For Android 3.0+ public void openFileChooser(ValueCallback<Uri> uploadMsg){mUM = uploadMsg;Intent i = new Intent(Intent.ACTION_GET_CONTENT);i.addCategory(Intent.CATEGORY_OPENABLE);i.setType('image/*');MainActivity.this.startActivityForResult(Intent.createChooser(i,'File Chooser'), FCR); } // For Android 3.0+, above method not supported in some android 3+ versions, in such case we use this public void openFileChooser(ValueCallback uploadMsg, String acceptType){mUM = uploadMsg;Intent i = new Intent(Intent.ACTION_GET_CONTENT);i.addCategory(Intent.CATEGORY_OPENABLE);i.setType('*/*');MainActivity.this.startActivityForResult(Intent.createChooser(i, 'File Browser'),FCR); } //For Android 4.1+ public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){mUM = uploadMsg;Intent i = new Intent(Intent.ACTION_GET_CONTENT);i.addCategory(Intent.CATEGORY_OPENABLE);i.setType('image/*');MainActivity.this.startActivityForResult(Intent.createChooser(i, 'File Chooser'), MainActivity.FCR); } //For Android 5.0+ public boolean onShowFileChooser( WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams){if(mUMA != null){ mUMA.onReceiveValue(null);}mUMA = filePathCallback;Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);if(takePictureIntent.resolveActivity(MainActivity.this.getPackageManager()) != null){ File photoFile = null; try{photoFile = createImageFile();takePictureIntent.putExtra('PhotoPath', mCM); }catch(IOException ex){Log.e(TAG, 'Image file creation failed', ex); } if(photoFile != null){mCM = 'file:' + photoFile.getAbsolutePath();takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); }else{takePictureIntent = null; }}Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);contentSelectionIntent.setType('image/*');Intent[] intentArray;if(takePictureIntent != null){ intentArray = new Intent[]{takePictureIntent};}else{ intentArray = new Intent[0];}Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);chooserIntent.putExtra(Intent.EXTRA_TITLE, 'Image Chooser');chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);startActivityForResult(chooserIntent, FCR);return true; }});}

標簽: web
相關文章:
主站蜘蛛池模板: 毛片在线不卡 | 美女张开腿让我桶 | 成人91 | 精品一区二区三区视频 | 欧美视频一区二区三区四区 | 欧美影院久久 | 欧美成人三级网站在线观看 | 久久99国产精品久久欧美 | 欧美一级毛片片免费孕妇 | 久久精品国产99久久香蕉 | 久久一日本道色综合久 | 成人国产一区二区三区精品 | 手机看片日本 | 曰本女同互慰高清在线观看 | 欧美区一区二区三 | 福利一区三区 | 最新亚洲精品国自产在线 | 国产高清在线观看视频手机版 | a级国产乱理伦片在线 | 亚洲视频免费一区 | 自拍视频在线观看 | 国产精品久久久久久久专区 | 国产成人免费网站在线观看 | 大尺度福利视频在线观看网址 | 69凹凸国产成人精品视频 | 成 人 在 线 免费 8888 www | 99在线精品视频免费观里 | 欧美特黄一级高清免费的香蕉 | 在线观看黄网视频免费播放 | 欧美一级毛片aaa片 欧美一级毛片不卡免费观看 | 欧美一级特毛片 | 亚洲免费久久 | 国产精品资源 | 久久国产精品夜色 | 欧美日韩精品在线播放 | 色日韩 | 中文字幕成人在线观看 | 香港aa三级久久三级老师 | 三级网站 | 国产精选在线视频 | 亚洲国产经典 |