fileupload.lzx
<library>
<class name="fileupload">
<attribute name="isOnlyImage" value="false
" type="boolean"/>
<attribute name="isOnlyPpt" value="false
" type="boolean"/>
<method event="oninit" args="invoker">
this.fr = new flash.net.FileReference();
Debug.write(this.fr);
this.fr.addListener(invoker);
</method>
<method name="browse">
if (this.isOnlyImage){
var allTypes = new Array();
var imageTypes = new Object();
imageTypes.description = "Images/Presentations (*.jpg, *.jpeg, *.gif, *.png, *.ppt, *.odp)";
imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png; *.ppt; *.odp";
allTypes.push(imageTypes);
this.fr.browse(allTypes);
} else if(this.isOnlyPpt){
var allTypes = new Array();
var imageTypes = new Object();
imageTypes.description = "Powerpoint (*.ppt, *.odp)";
imageTypes.extension = "*.ppt; *.odp;";
allTypes.push(imageTypes);
this.fr.browse(allTypes);
} else if(this.isOnlyMP3){
var allTypes = new Array();
var imageTypes = new Object();
imageTypes.description = "Audio (*.mp3, *.wav, *.vox)";
imageTypes.extension = "*.mp3; *.wav; *.vox";
allTypes.push(imageTypes);
this.fr.browse(allTypes);
} else {
this.fr.browse();
}
</method>
<method name="getName">
return this.fr.name;
</method>
<method name="upload" args="url">
Debug.write("url: ",url);
this.fr.upload(url);
</method>
<method name="onCancel" args="fr">
Debug.write('onCancel invoked');
</method>
<method name="onHTTPError" args="fr, httpError">
Debug.write('onHTTPError invoked: ' + httpError);
</method>
<method name="onIOError" args="fr">
Debug.write('onIOError invoked',this.fr);
</method>
<method name="onOpen" args="fr">
Debug.write('onOpen invoked');
</method>
<method name="onSecurityError" args="fr, errorString">
Debug.write('onSecurityError invoked: ' + errorString);
</method>
</class>
</library>