如何使用dropbox saver api将多个图像文件保存到Dropbox?

时间:2015-06-09 17:45:25

标签: ajax api dropbox dropbox-api dropbox-php

我正在尝试使用dropbox saver api将多个图像保存到Dropbox但我的代码不保存图像,我没有得到任何错误,也没有确认。( dropbox saver窗口弹出并单击save并关闭但没有确认!)任何人都可以告诉我如何解决这个问题吗?

注意:我可以使用此函数调用保存一个图像:

Dropbox.save('<?PHP  echo $imagePath1_Value; ?>', 'image1.jpg', options);

完整代码:

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

function saver(){

var options = { 

files: [
        // You can specify up to 100 files.
        // ...
        {'url': '<?PHP  echo $imagePath1_Value; ?>', 'filename': '1.jpg'},
        {'url': '<?PHP  echo $imagePath2_Value; ?>', 'filename': '2.jpg'},
        {'url': '<?PHP  echo $imagePath3_Value; ?>', 'filename': '3.jpg'},

    ],

    // Success is called once all files have been successfully added to the user's
    // Dropbox, although they may not have synced to the user's devices yet.
    success: function () {
        // Indicate to the user that the files have been saved.
        alert("Success! Files saved to your Dropbox.");
    },

    // Progress is called periodically to update the application on the progress
    // of the user's downloads. The value passed to this callback is a float
    // between 0 and 1. The progress callback is guaranteed to be called at least
    // once with the value 1.
    progress: function (progress) {},

    // Cancel is called if the user presses the Cancel button or closes the Saver.
    cancel: function () {},

    // Error is called in the event of an unexpected response from the server
    // hosting the files, such as not being able to find a file. This callback is
    // also called if there is an error on Dropbox or if the user is over quota.
    error: function (errorMessage) {}

};

Dropbox.save(options);
};
</script>
<button onclick="saver()">save(Multiple images)</button>

0 个答案:

没有答案