Reputation: 802
I am trying to back up a database to the Appcelerator Cloud Services, however, the database fails to save. I currently have the following code:
var dbPath = 'file:///data/data/' + Ti.App.getID() + '/databases/';
var dbFile = Ti.Filesystem.getFile(dbPath + 'myDb');
Cloud.Files.create({
name: 'myDb',
file: dbFile
}, function (e) {
if (e.success) {
var file = e.files[0];
alert('File successfully backed up!');
} else {
alert('File save error!');
}
});
Does anyone know what I am doing wrong here?
Upvotes: 1
Views: 269
Reputation: 7028
Check if your file isn't bigger than 25MB size for file.
There is event error and message property with additional information why file creation failed.
Cloud.Files.create({
name: 'myDb',
file: dbFile
}, function (e) {
if (e.success) {
var file = e.files[0];
alert('File successfully backed up!');
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
For more detailed information see Appcelerator Cloud documentation.
Upvotes: 1