2013-10-25 40 views
1

在我的手機間隙應用我想使用文件傳輸選項可將圖像中server.I傳輸使用了下面的代碼文件傳輸錯誤

function uploadPhoto(imageURI) 
     { 
      var options = new FileUploadOptions(); 
      options.fileKey="file"; 
      options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1); 
      options.mimeType="image/jpeg"; 
      var params = {}; 
      params.value1 = "Admin"; 
      params.value2 = "Admin123"; 
      options.params = params; 
      var ft = new FileTransfer(); 
      ft.upload(imageURI, encodeURI("ftp.bimgupl.com/itemimage/"), win, fail, options); 
     } 

     function win(r) 
     { 
      console.log("Code = " + r.responseCode); 
      console.log("Response = " + r.response); 
      console.log("Sent = " + r.bytesSent); 
     } 

     function fail(error) 
     { 
      alert("An error has occurred: Code = " + error.code); 
      console.log("upload error source " + error.source); 
      console.log("upload error target " + error.target); 
     } 

在上面的代碼返回結果爲

An error has occured:Code=3 

鏈接詳情如下

FTP username: Admin 
FTP Password: Admin123 
FTP server: ftp.bimgupl.com 
FTP & explicit FTPS port: 21 

請告訴我錯我的代碼?請幫我溶膠這個問題。

回答

1

你無法直接上傳文件到FTP server..you會需要一個PHP處理程序來上傳文件移動到所需的directory..Read這個 file upload php