Skip to content

Instantly share code, notes, and snippets.

@kbshl
Created November 18, 2016 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbshl/f2b5305ff08e0621295018910f534f87 to your computer and use it in GitHub Desktop.
Save kbshl/f2b5305ff08e0621295018910f534f87 to your computer and use it in GitHub Desktop.
The right and wrong way to save file paths in Titanium Mobile - From http://skypanther.com/2015/08/the-right-and-wrong-way-to-save-file-paths-in-titanium
// right way:
var file = Titanium.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, filename);
file.write(imageBlobData);
// save only the file's name
myModel.set('filepath', filename);
myModel.save();
// then this will work even after an upgrade
myImageView.image = Ti.Filesystem.applicationDataDirectory + myModel.get('filepath');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment