save downloaded file automatically in directory using AIR

Posted by rie on Stack Overflow See other posts from Stack Overflow or by rie
Published on 2010-06-14T14:39:15Z Indexed on 2010/06/14 14:42 UTC
Read the original article Hit count: 211

Filed under:
|
|
|
|

i'm newbie, so please help me...

package com.func {
    public class Downloader {
        import flash.net.FileReference;
        import flash.net.URLRequest;

        private var req:URLRequest = new URLRequest();
        private var fr:FileReference = new FileReference();
        public function Downloader(){
        }

        public function download():void{
            req.url = "http://www.yourdomain.com/example.txt";
            fr.download(req);
        }
    }
}

how to save downloaded file automatically in file system directory (ex: applicationDirectory as default), without open browse dialog to save the file. thaks....

© Stack Overflow or respective owner

Related posts about flex

Related posts about flash