亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術(shù)文章
文章詳情頁

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

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

問題描述

求解!安卓webview無法運行<input type='file' name='file' /> 標(biāo)簽!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:

這個已經(jīng)有人問過了,我已經(jīng)回答過了,親測完全沒問題。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; }});}

標(biāo)簽: web
相關(guān)文章:
主站蜘蛛池模板: 日韩美一区二区 | 在线观看中文字幕国产 | 成人国内精品久久久久影院 | 无码精品日韩中文字幕 | 麻豆视频免费观看 | 久久99精品久久久久久国产越南 | 成 黄 色 激 情视频网站 | 九九99国产精品视频 | 性做久久久久久网站 | 国产高清色播视频免费看 | 婷婷六 | 国产精品亚洲第一区焦香 | 国产美女主播在线 | x8x8国产在线观看2021 | aa国产| 中文字幕国产在线 | 亚洲欧美色欧另类欧 | 久久成人免费网站 | 欧美精品一区二区三区四区 | 看免费的黄色片 | 亚欧成人毛片一区二区三区四区 | 中文字幕有码热在线视频 | 欧美三j片 | 亚洲精品亚洲人成在线观看麻豆 | 国产一级特黄aa大片在线 | 国外成人在线视频网站 | 亚州综合激情另类久久久 | 国产精品欧美亚洲韩国日本久久 | 另类欧美日韩 | 在线观看香蕉视频 | 一级a级毛片 | 一级黄色大片视频 | 国产福利视频在线观看 | 国产精品合集久久久久青苹果 | 国产高清视频免费在线观看 | 99精品热视频这里只有精品7 | 成年人黄色毛片 | 日韩精品一区二区三区不卡 | 日韩大胆视频 | a级国产乱理论片在线观看看 | 国产激爽大片高清在线观看 |