# Filereference work in localhost but not in server!

**URL:** https://forum.kirupa.com/t/filereference-work-in-localhost-but-not-in-server/312189
**Category:** flash
**Created:** [July 27, 2010, 6:28pm UTC](https://forum.kirupa.com/t/filereference-work-in-localhost-but-not-in-server/312189 "2010-07-27T18:28:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![YenXz](https://avatars.discourse-cdn.com/v4/letter/y/eb9ed0/32.png) [@YenXz](https://forum.kirupa.com/u/YenXz)
#### Post date: [July 27, 2010, 6:28pm UTC](https://forum.kirupa.com/t/filereference-work-in-localhost-but-not-in-server/312189/1 "2010-07-27T18:28:08Z")

</div>

My file reference function is not working when i upload my swf into my server. I tried in localhost it works. I tried publishing in HTML it works. I wonder what’s wrong.

Here is the screen shot of my code.  
 ![](http://forum.kirupa.com/uploads/kirupa/6302/e0d61410514405c1.png)

The file reference is suppose to allow the user to save the “var ba” to their local hardisk. Thanks in advance.

Edit : i found that my preloader is the main cause. Any code i should put in my preloader so the file reference will works?

this is the preloader code

```auto
import flash.net.FileReference;

var loader:Loader = new Loader();//declaring new loader variable
 // adding loader into the stage
//loader's funtion.
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);

loader.load(new URLRequest("2DavatarGame2.swf"));//loader loading the 2d Avatar game
this.addChild(loader);

//doing the progress bar.
function loading(e:ProgressEvent){
var perc:Number = e.bytesLoaded / e.bytesTotal;
  percent.text = Math.ceil(perc*100).toString()+"%";
  loaderBar.scaleX=perc;
}

//removing unneccesary item from the stage.
function done(e:Event){
    removeChild(percent);
    removeChild(loaderBar);
    removeChild(_title);
    removeChild(loadingclip);

}

```
