Hello
In my application, i have to upload a local file and send it to a server.
There is my code :
............
private const FILE_UPLOAD_URL:String =
"http://www.YOUR-WEBSITE-HERE.com/fileref/uploader.cfm";
private function init():void
{
fileRef = new FileReference();
var textTypes:FileFilter = new FileFilter("WSDL file",
"*.pdf ; *.wsdl");
xmlTypes= new Array(textTypes);
//the upload
fileRef.addEventListener(Event.SELECT, fileRef_select);
fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
}
<mx:Button label="Upload file" id="btn_upload" click="browseAndUpload();"
x="384" y="59" enabled="true"/>
private function browseAndUpload():void
{
fileRef.browse(xmlTypes);
}
private function fileRef_select(evt:Event):void {
try {
fileRef.upload(new URLRequest(FILE_UPLOAD_URL));
// fileRef.load
//fileRef.save();
//display the name of the file in the AreaText
forChange.text = fileRef.name;
//fill in the file in the List
myCB.dataProvider = fileRef.name;
} catch (err:Error) {
//message.text = "ERROR: zero-byte file";
Alert.show("ERROR to upload the file");
}
}
When i add fileRef.load in the code that provides ERROR :( :(
However i don't understand what should i put in the variable FILE_UPLOAD_URL ??
Any idea please :(
Thanks for your help
;)
_________________________________________________________________
La boîte mail NOW Génération vous permet de réunir toutes vos boîtes mail dans
Hotmail !
http://www.windowslive.fr/hotmail/nowgeneration/