Click here to Skip to main content
15,911,306 members

Comments by Ram Sam 2 (Top 4 by date)

Ram Sam 2 28-Mar-12 2:29am View    
public var fileStream:FileStream;
public function browse_file(eve:MouseEvent):void{
file1 = File.documentsDirectory;
file1.addEventListener(Event.SELECT, handleSelectFile);
file1.browseForOpen("Select Picture");
}
public function handleSelectFile(event:Event):void
{
file_name.text = event.target.nativePath;
//stream=event.target.type;
//Alert.show(stream);
var fileloader:Loader = new Loader();
fileloader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoadFile);
fileloader.load(new URLRequest(event.target.url));
}

public function handleLoadFile(event:Event):void
{


}
// upload button action
public function fileuploads(event:MouseEvent):void{

var file:File = new File(file_name.text);
if ( file.extension == "txt" )//we check to see if file extension is txt if not we don't do anything otherwise we execute the desired action
{
readfiles(file.url,file.name);


}else if(file.extension=="doc" || file.extension=='pdf'){
readpdffiles(file.url,file.name);
}
}

public function readpdffiles(target_url:String,fname:String,startIndex:int = 0,endIndex:int = int.MAX_VALUE):void
{
var file:File=new File(target_url);
var fs:FileStream=new FileStream();
fs.open(file,FileMode.READ);
var data:ByteArray=new ByteArray();
data.writeObject(fs.readByte());

}
note :here i am able to read txt file as string and able to store .but i dnt know for pdf,doc file?can u check?
Ram Sam 2 28-Mar-12 0:36am View    
k but i need code in flex .can u post code in that language?
Ram Sam 2 27-Mar-12 9:50am View    
any way i just need to read and store pdf file ,doc file in sqlite database from flex air application.can u post code to read of pdf and doc files in flex.any one also welcome.
'it is urgent...'
Thanks in advance...
Ram Sam 2 27-Mar-12 0:55am View    
thanks,can u post code to store and retrive only txt file in sqlite database in flex air application.