2017-08-09 61 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() {} 
    }); 
    }, 
})