Check If A File Exists Locally Using JavaScript Only
Answer : Your question is ambiguous, so there are multiple possible answers depending on what you're really trying to achieve. If you're developping as I'm guessing a desktop application using Titanium, then you can use the FileSystem module's getFile to get the file object, then check if it exists using the exists method. Here's an example taken from the Appcelerator website: var homeDir = Titanium.Filesystem.getUserDirectory(); var mySampleFile = Titanium.Filesystem.getFile(homeDir, 'sample.txt'); if (mySampleFile.exists()) { alert('A file called sample.txt already exists in your home directory.'); ... } Check the getFile method reference documentation And the exists method reference documentation For those who thought that he was asking about an usual Web development situation, then thse are the two answers I'd have given: 1) you want to check if a server-side file exists. In this case you can use an ajax request try...