# Actionscript : download file

**URL:** <https://forum.kirupa.com/t/actionscript-download-file/180426>\
**Category:** Uncategorized\
**Created:** [February 28, 2006, 3:54pm UTC](https://forum.kirupa.com/t/actionscript-download-file/180426 "2006-02-28T15:54:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ymk\_alex](https://avatars.discourse-cdn.com/v4/letter/y/67e7ee/32.png) [@ymk\_alex](https://forum.kirupa.com/u/ymk_alex)\
**Post date:** [February 28, 2006, 3:54pm UTC](https://forum.kirupa.com/t/actionscript-download-file/180426/1 "2006-02-28T15:54:54Z")

</div>

i got this script from the library from flash but i cant seem to make it work on local folders.

i tried to replace the “[http://balbal](http://balbal)” with just “…/mov/movie.mov” and it doesnt work. What seems to be the problem?

```auto
import flash.net.FileReference;

var listener:Object = new Object();

listener.onSelect = function(file:FileReference):Void {
    trace("onSelect: " + file.name);
}

listener.onCancel = function(file:FileReference):Void {
    trace("onCancel");
}

listener.onOpen = function(file:FileReference):Void {
    trace("onOpen: " + file.name);
}

listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
    trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}

listener.onComplete = function(file:FileReference):Void {
    trace("onComplete: " + file.name);
}

listener.onIOError = function(file:FileReference):Void {
    trace("onIOError: " + file.name);
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
var url:String = "http://www.macromedia.com/platform/whitepapers/platform_overview.pdf";
if(!fileRef.download(url, "FlashPlatform.pdf")) {
    trace("dialog box failed to open.");
}

```
