2017-08-09 79 views
0

我想要使用Dropbox上傳文件,基於meteor上我的cordova應用程序,即如果用戶點擊時使用dropbox上傳文件,用戶將被授予選項在按鈕上,然後inappbrowser應該打開用戶將從哪裏進行身份驗證,並可以上傳文件。無法通過在流星上使用dropbox上傳文件

我使用下面的腳本

<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="id_dropbox" data-app-key="xxxxxxxxxxx"></script> 

這是代碼

 e.preventDefault(); 
     Dropbox.choose({ 
      linkType: "direct", 
      multiselect: false, 
      extensions: ['.doc'], 
      success: function(files) { 
       console.log("files ", files[0]); 
       if(files[0]['bytes']<1000000){ 
        GetBlobDataDropbox(files) //function to upload file 
       }else{ 
        alert('Size should be less than 1 mb') 
       } 
      }, 
      error:function(error){console.log(error)}, 
      cancel: function() {} 
     }); 

這是給我下面的錯誤。

最大調用堆棧大小勝過。

請告訴如何解決它。

+0

請分享您的'GetBlobDataDropbox'代碼。 – Styx

+0

代碼流無法進入Dropbox.choose,之前顯示錯誤。 當我在Dropbox.choose之前在控制檯上打印Dropbox時,它包含值,即它被定義。 –

+0

在向我們展示其餘代碼之前,恐怕我們無法幫助您。 – Styx

回答

0

這是我的代碼周圍的模板代碼。我沒有在這個模板上使用助手。

Template.AttachResume.events({ 
    'click #dropbox' : function(e){ 
    console.log('dropbox123 ',Dropbox) 
    e.preventDefault(); 
    Dropbox.choose({ 
     linkType: "direct", 
     multiselect: false, 
     extensions: ['.doc', '.docx', '.pdf', '.rtf', '.txt', '.odt'], 
     success: function(files) { 
      console.log("files ", files[0]); 
      if(files[0]['bytes']<1000000){ 
       GetBlobDataDropbox(files) 
      }else{ 
       alert('Size should be less than 1 mb') 
      } 
     }, 
     error:function(error){console.log(error)}, 
     cancel: function() {} 
    }); 
    }, 
})