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);
  });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.