Hello !!
I need help, creating an .asp that I can use to upload files on server.
I have watched the data sent by the flex application with tcpmon,
but I can't understand what I must do. So, is there anybody who can
help me. PLS :( !!!
I am using the following code in the A.S. flex file:
private function initApp():void {
fileRef = new FileReference();
fileRef.addEventListener(Event.CANCEL, traceEvent);
fileRef.addEventListener(Event.COMPLETE, completeEvent);
fileRef.addEventListener(Event.SELECT, selectEvent);
fileRef.addEventListener(IOErrorEvent.IO_ERROR, traceEvent);
fileRef.addEventListener(Event.OPEN, traceEvent);
fileRef.addEventListener(ProgressEvent.PROGRESS, progressEvent);
fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
traceEvent);
}
private function traceEvent(event:Event):void {
var tmp:String = "================================\n";
ta.text += tmp + event.type + " event:" +
mx.utils.ObjectUtil.toString(event) + "\n" ;
ta.verticalScrollPosition += 20;
}
private function ioErrorEvent(event:IOErrorEvent):void{
Alert.show("IOError:" + event.text);
traceEvent(event);
}
private function selectEvent(event:Event):void{
btn_upload.enabled = true;
traceEvent(event);
filename.text = fileRef.name;
progressBar.setProgress(0, 100);
progressBar.label = "Loading 0%";
}
private function progressEvent(event:ProgressEvent):void {
progressBar.setProgress(event.bytesLoaded, event.bytesTotal);
traceEvent(event);
}
private function completeEvent(event:Event):void {
progressBar.label = "Complete.";
filename.text += " uploaded";
traceEvent(event);
btn_upload.enabled = false;
btn_cancel.enabled = false;
}
private function uploadFile(endpoint:String):void {
var param:String = "Author=" + ti_author.text;
var req:URLRequest = new URLRequest(endpoint);
req.method = URLRequestMethod.POST;
fileRef.upload(req, param, false);
progressBar.label = "Uploading...";
btn_cancel.enabled = true;
}
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/