2014-02-12 136 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

相关问题