[英]Overwrite option for dropbox filesUpload Javascript API?
I am using following code snippet for uploading a file to Dropbox 我正在使用以下代码片段将文件上传到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()
? 如何在
filesUpload()
中将overwrite选项设置为true?
[Cross-linking for reference: https://www.dropboxforum.com/t5/API-support/Specify-overwrite-option-while-uploading-file-using-javascript/mp/225532#M12250 ] [参考交叉链接: https : //www.dropboxforum.com/t5/API-support/Specify-overwrite-option-while-uploading-file-using-javascript/mp/225532#M12250 ]
You can specify the 'overwrite' FilesWriteMode
in the FilesCommitInfo
passed to filesUpload
like this: 你可以指定“覆盖”
FilesWriteMode
在FilesCommitInfo
传递给filesUpload
是这样的:
dbx.filesUpload({path:"/"+file.name, contents:content, mode:'overwrite'})
.then(function(response) {
console.log(response);
})
.catch(function(error) {
console.error(error);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.