2017-10-10 52 views
0

當我試圖從android上傳一個新文件時,它工作正常,但是當我試圖從上傳後的OS設備上傳一個Android設備上傳6棉花糖不言而喻onError方法,這是響應:通過在Android 6上的http請求上傳pdf文件時出現錯誤appcelerator

[ERROR] linker: readlink('/proc/self/fd/54') failed: Permission denied [fd=54] 
[ERROR] linker: warning: unable to get realpath for the library "libRSDriver.so". Will use given name. 
[ERROR] linker: readlink('/proc/self/fd/54') failed: Permission denied [fd=54] 
[ERROR] linker: warning: unable to get realpath for the library "libRSCpuRef.so". Will use given name. 
[ERROR] linker: readlink('/proc/self/fd/54') failed: Permission denied [fd=54] 
[ERROR] linker: warning: unable to get realpath for the library "libblas.so". Will use given name. 

,這是代碼:

var intent = Ti.Android.createIntent({ 
     action: Ti.Android.ACTION_GET_CONTENT, 
     type: "application/pdf" 
    }); 

    var x = Ti.Android.createIntentChooser(intent, "Select"); 
    $.index.getActivity().startActivityForResult(x, function(e) { 
     try { 
      var doc = Ti.Filesystem.getFile(e.intent.data); 

    var xhr = Ti.Network.createHTTPClient({ 
     onload: function() { 
      var result = JSON.parse(this.responseText); 
      console.log("File uploaded successfully : ", result); 
     }, 
     onsendstream: __.sendstream, 
     onerror: function() { 
      console.error("Error in upload file : ", this.responseText); 
     }, 
     timeout: 100000000000000000000 
    }); 
    xhr.open("POST", URL); 
    xhr.send(doc); 

     } catch (error) { 
      console.error("This is error : " + error); 
     } 
    }); 

回答

0

也許是因爲存儲的權限。

試試這個:

if (Ti.Filesystem.hasStoragePermissions()) 
{ 
    // app has storage permission 
} 
else 
{ 
    Ti.Filesystem.requestStoragePermissions(function(e) 
    { 
     if (e.success) 
     { 
      // permissions succesfully requested 
     } 
    }); 
} 
+0

我已經走權限的存儲,我可以把文件並上傳,但上傳的HTTP返回的onerror關閉 – user2678165

+1

的問題是在文件名文件名後用阿拉伯語郎,當我改變它的請求成功 – user2678165

相關問題