2013-02-21 10 views
0

PhoneGap을 사용하여 서버로 파일을 보내려고합니다. 여기에 다음 함수 매개 변수 파일 아래에 내 코드를 보내주십시오. 내가 로컬 호스트 서버로 가짜 URL을 삽입하면 그것은 나에게 서버 오류 코드 = 2를 보여주고, 내가 삽입 할 경우 실제 URL이 나를 찾을 수 없습니다 코드 파일이 표시되는 문제 = 1phonegap으로 서버에 파일 보내기

function gotFile(file) 
{ 
    navigator.notification.alert(file.fullPath); 

    var options = new FileUploadOptions(); 
     options.mimeType="image/jpg"; 
     options.fileKey="file"; 
     var params = {}; 
     params.IdPrestation = "3d660013-3028-46c3-adfa-d7141a712ed7"; 
     params.IdPhoto  = "3a660013-3028-46c3-adfa-d7141a712ed7"; 
     options.params = params; 
      options.chunkedMode = true ; 

     var ft = new FileTransfer(); 

       ft.upload(file.fullPath,encodeURI('http://Myserver.fr/Phototheque.asmx/SavePhoto'),function(r) 
       {  
        //navigator.notification.alert(r.response,function(){}); 
        alert(r.response,function(){}); 
        console.log("Code = " + r.responseCode); 
        console.log("Response = " + r.response); 
        console.log("Sent = " + r.bytesSent); 
       }, 
       function(e) 
       { 
       //navigator.notification.alert('Serveur Erreur:' + e.code,function(){}); 
        cause_erreur(e.code); 
        /* 
        alert('Serveur Erreur:' + e.code,function(){}); 
        alert("upload error source " + e.source); 
        alert("upload error target " + e.target) 
        */ 
       }, 
       options 
       );//ft.upload 


} 

답변

0

내가 정확히 버그를 모르는 . 그러나 업로드 코드가 정상적으로 보이고 파일 크기 또는 네트워크 상태로 인해 오류가 발생할 수 있습니다. 동시에 서버에서 요청 및 응답이 예상대로 작동하는지 확인할 수 있습니다.