How access local files (system pdf,images,url) in tidesdk application using default programs.

by Thavamani 2013-07-29 10:19:06

I am building an windows app using Tide SDK. How can I open a local file from my app. For example, When I click on the link, I want it to open the pdf file url or images using default programm associated with pdf type file.
we can access local file system in tidesdk application.
See the following code.
var contents;
var file= 'test.txt';
var Dir = Ti.Filesystem.getUserDirectory();
var readfi= Ti.Filesystem.getFile(Dir, file);
if (readfi.exists())
{
var Stream = Ti.Filesystem.getFileStream(readFi);
Stream.open(Ti.Filesystem.MODE_READ);
contents =Stream.read();
alert( contents );
Stream.close();
}

The above code will read the text file and alert the content
<br/>
Following code will open the given URL in default browser.<br>
Ti.Platform.openURL('http://hioxorg.in');


Following code will Open the given application or file in the system's default program.

Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/readme.txt');
Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/cart15.png');
508
like
0
dislike
0
mail
flag

You must LOGIN to add comments