flex - Is it possible to load a local file without having to ask the user to browse to it first in an AIR Application? -
i'm writing small application myself , instead of using database i'd use excel store small amount of data have on local file system. want able load data without having use typical filereference browse()
method annoying every time use application.
the code below seems find file fine file.exists method below , of other attributes seem correct file.data
null.
i'm guessing security issue , that's why i'm running problem thought i'd ask , see if there in fact way around problem.
var file:file = new file(fullpath + "\\" + currentfolder + ".txt"); if(file.exists) { var bytearray:bytearray = file.data; }
if want read content of file, use following code:
var stream:filestream = new filestream(); stream.open("some path here", filemode.read); var filedata:string = stream.readutfbytes(stream.bytesavailable); trace(filedata);
the data property inherited filereference class , populated after load call (see link).
Comments
Post a Comment