1

I am using following code snippet for uploading a file to Dropbox

dbx.filesUpload({path:"/"+file.name, contents:content})
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.error(error);
    });

This is working as intended but throwing a path conflict error second time onward because the file exists already. How can I set the overwrite option true in the filesUpload() ?

1 Answer 1

2

[Cross-linking for reference: https://www.dropboxforum.com/t5/API-support/Specify-overwrite-option-while-uploading-file-using-javascript/m-p/225532#M12250 ]

You can specify the 'overwrite' FilesWriteMode in the FilesCommitInfo passed to filesUpload like this:

  dbx.filesUpload({path:"/"+file.name, contents:content, mode:'overwrite'})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.error(error);
  });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.