How to save multiple image files to dropbox using dropbox saver api?

406 views Asked by At

I am trying to save multiple images to dropbox using dropbox saver api but my code doesnt save the images and i dont get any error and no confirmation .(dropbox saver window pops up and click save and it closes but no confirmation!) could any one tell me how to fix this problem ?

Note: I am able to save one image using this function call:

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

full code:

<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

There are 0 answers