1

I have the following code to upload a database to the Titanium Cloud:

Cloud.Files.create({
    name : dbName,
    file : dbFile
}, function(e) {
    if (e.success) {
        var file = e.files[0];
        alert('Boats successfully backed up to cloud!');
    } else {
        alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
    }
});

However, if the database is saved more than once, it uploads another copy alongside the old copy. I would only like to have a single copy of my database on the cloud. I know there are the methods Cloud.Files.remove and Cloud.Files.update, and I would like to use one of them to keep a single copy per user of my database on the cloud. However, they have a value known as file_id. What is this value and what should it be?

4

1 回答 1

0

您应该使用Cloud.Files.query()检查文件是否已经存在,然后根据结果使用Cloud.Files.create()或。Cloud.Files.update()

于 2013-11-15T00:00:19.060 回答