无法使用基于meteor的cordova app上的dropbox上传文件

时间:2017-08-09 04:48:42

标签: meteor

我想使用dropbox根据流星上传我的cordova应用程序上的文件,即如果用户想要使用dropbox上传文件,如果用户点击按钮,那么用户将获得选项,然后inappbrowser应该打开用户将被认证的位置可以上传文件。

我正在使用以下脚本

<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() {}
        });

这让我失误。

  

超出最大调用堆栈大小。

请告诉我们如何解决它。

1 个答案:

答案 0 :(得分: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() {}
    });
  },
})