2012-04-23 9 views
0

私の問題は写真を撮ってphp(サーバー)に送る必要がありますが、私はdifferentsコードで試してみます。期待される応答がある私はPhonegap(Android)で写真を撮ってphp(SERVER)に送ってください。

function startCamera() { 

      navigator.camera.getPicture(onSuccess, onFail, { 
       quality: 50,  
       destinationType: navigator.camera.DestinationType.DATA_URL 
      }); 
      function onSuccess(imageData){  

       alert(imageData); 
       var url = "http://www.trueware.mx/eduardo/mybiometrics_online/foto.php?callback=parseRequest&foto="+imageData; 
       var script = document.createElement('script'); 
       script.setAttribute('src', url); 
       document.getElementsByTagName('head')[0].appendChild(script); 
      } 
      function onFail(message) 
      {  
       alert('Failed because: ' + message); 
      } 
     } 
     function parseRequest(response) 
     { 
      try 
      { 
       console.log(response); 
       for (var i=0; i < response.length; i++) { 
         var dato = response[i].foto; 
         alert(dato); 
         var foto=Base64.decode(response[i].foto); 
         var imagen = document.createElement('img'); 
         imagen.setAttribute('src',foto); 
         document.getElementById('cabezera').appendChild(imagen); 
       } 
      } 
      catch(an_exception) 
      { 
       document.write("Error de Conexion"); 
      } 
     } 

私は助けとそれを行うための例が必要です。

のjavascriptの一部と誰かができた場合は、私がgratefull

答えて

関連する問題