2014-02-12 192 views
0

您好我正在開發一個原生android應用程序的電話差距,在該應用程序我想上傳圖像文件通過選擇文件按鈕,當我點擊按鈕我想打開設備庫,但畫廊窗口不打開。當我通過設備中的瀏覽器加載時,我可以打開圖庫窗口,但無法爲android本地生成,所以請幫助我找到解決方案。phonegap原生android應用程序問題

將被添加各種平臺的手機差距腳本文件的變化,或者需要任何插件文件用於各種平臺的手機中的間隙或我需要添加任何cordova.js文件根目錄的文件(如WWW)。

我懷疑電話缺口或設備中的任何種類的版本兼容性問題,請幫助我。

瞭解更多詳情,我會在下面添加我的代碼。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> 
    <link rel="stylesheet" type="text/css" href="css/style.css" /> 
    <link rel="stylesheet" type="text/css" href="js/jquery/plugins/jqtransform/jqtransform.css" /> 
    <title> Mobile</title> 
    <script src="js/jquery/jquery162min.js" type="text/javascript"></script> 
    <script src="js/jquery/plugins/accordion/jqueryui1814custommin.js" type="text/javascript"></script> 
    <script type="text/javascript" src="js/jquery/plugins/jqtransform/jqtransform.js" ></script> 
    <script src="js/mgeneral.js" type="text/javascript"></script> 
    <script src="../js/pl/plupload.js" type="text/javascript"></script> 
    <script src="../js/pl/plupload.html5.js" type="text/javascript"></script> 

<script type="text/javascript" language="javascript"> 
$(document).ready(function() { 
    /*Set skin for select, options and checkbox*/ 
    $('.skinnable').jqTransform({ imgPath: 'img/' }); 

    $('#apply-to-selection-2').click(function (e) { 
     e.preventDefault(); 
     Logout(); 
     if (RTNCODE) 
      window.location = "index.html"; 

    }); 

    /*table row select*/ 
    $("table.grid thead tr th.col-row-select input").click(function() { 
     if (!$(this).is(":checked")) { 
      $("table.grid tbody tr td.col-row-select input").each(function() { 
       $(this).attr("checked", true); 
       $(this).change(); 
      }); 
     } 
     else { 
      $("table.grid tbody tr td.col-row-select input").each(function() { 
       $(this).attr("checked", false); 
       $(this).change(); 
      }); 
     } 
    }); 
    /*END table row select*/ 
    /*Create accordion*/ 
    $(".accordion").accordion({ 
     header: ".accordion-tab", 
     collapsible: true, 
     active: 0, 
     autoHeight: false 
    }); 

}); 
    </script> 

    <script type="text/javascript"> 

    $(function() { //image loader 
     var uploaderimage = new plupload.Uploader({ 
      // General settings 
      runtimes: 'html5', 
      container: 'imagecontainer', 
      browse_button: 'pickfiles', 
      url: '/imageupload.ashx?mobile=true', 
      multi_selection: false, 
      max_file_size: '10mb', 
      //chunk_size: '1mb', 
      multipart: true, 
      urlstream_upload: true, 
      // Specify what files to browse for 
      filters: [ 
          { title: "Image files", extensions: "jpg,gif,png" } 
      ] 


     }); 

     uploaderimage.init(); 


     uploaderimage.bind('FilesAdded', function (up, files) { 
      //   showmodalmask(); 
      uploaderimage.start(); 
      $('.imgpre').show(); 
      $('.imgcpl').hide(); 
     }); 

     uploaderimage.bind('FileUploaded', function (up, file) { 
      if (uploaderimage.total.uploaded == uploaderimage.files.length) { 
       //   $('.btnrefresh').click(); 
       $('.imgcpl').show(); 
       $('.imgpre').hide(); 
       } 
      }); 
     }); 
    </script> 
</head> 

<body> 
    <div class="container"> 
    <div class="frame"> 
    <div class="frame-border-top"></div> 
    <div class="frame-border-middle"> 
     <div class="cute" style=""> 
     <h1 class="header" style="color:transparent; width:270px; height:20px;"> 
    </h1></div> 
    <!-- MENU START XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> 

    <div id="tabs-2" style="background-color:Black; border:1px solid #363636;"> 
     <div style="margin-left:-15px; margin-top:-6px;"> 
      <div class="form-row padding-lr-5" style="text-align:center;"> 
       <div id="imagecontainer" > 

       <div id="filelist"></div> 

       <br /> 

       <a id="pickfiles" href="#" style="background-color: #447cd1; color: white; border: 2px solid #113b7c; border-radius: 12px; padding: 6px 10px; font-size: 12pt; text-decoration: none">Select file</a> 

      </div> 
       <br /> 
       <div class="holderloderp imgpre" style="display:none"><img src="../images/pnl-preloader2.gif" width="25" height="25" alt="" class="pnl-preloader2" /></div> 
       <div class="imgcpl" style="color: green; display: none" >Complete</div> 
      </div> 
       <div class="clear" style="height:25px;"></div> 
      </div> 
      </div> 
     </div> 
     </div> 
    </div> 
    </div> 
</div> 

回答

0

您需要使用PhoneGap的API,它會使用任何服務器端腳本文件處理程序做上傳到服務器的文件傳輸對象。

Look at this link

+0

我已經試過鏈接代碼,但頁面未加載。我收到錯誤[link](http://goo.gl/a4SAlR) – user3273902

相關問題