Sorry, I've never really needed to use it, though there is an example in
the Flash help docs.

The following example creates a FileReference object that prompts the
user to select an image or text file to be uploaded. It also listens for
any possible event. 

import flash.net.FileReference;

var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
allTypes.push(imageTypes);

var textTypes:Object = new Object();
textTypes.description = "Text Files (*.txt, *.rtf)";
textTypes.extension = "*.txt;*.rtf";
allTypes.push(textTypes);

var listener:Object = new Object(); 

listener.onSelect = function(file:FileReference):Void {
    trace("onSelect: " + file.name);
 
if(!file.upload("http://www.yourdomain.com/yourUploadHandlerScript.cfm";)
) {
        trace("Upload dialog failed to open.");
    }
}

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.onHTTPError = function(file:FileReference):Void {
    trace("onHTTPError: " + file.name);
}

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

listener.onSecurityError = function(file:FileReference,
errorString:String):Void {
    trace("onSecurityError: " + file.name + " errorString: " +
errorString);
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse(allTypes);


Seems to me, this example is all that you'll need for the front end.

Lee





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Riccardo
Roasio
Sent: 24 March 2006 10:29
To: Flashcoders mailing list
Subject: Re: [Flashcoders] upload a file

Do you have an example for this?
Thanks,Riccardo

Lee McColl-Sylvester wrote:

>Not really no... In the flash, you use flash.net.FileReference to
browse
>for your file and send the file to the server... But on the server
side,
>you need a standard script, either in PHP or whatever language you want
>to use, which deserializes the stream back into a file... You need this
>whether you send files using HTML or Flash, so you can probably grab a
>script off of hotscripts.com or somewhere similar.
>
>The point to note here is that the Flash flash.net.FileReference script
>that you write will be completely separate and unrelated to the script
>you need on the server.  It just needs to know that a file will be
sent.
>
>Lee
>
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of
Riccardo
>Roasio
>Sent: 24 March 2006 10:16
>To: Flashcoders mailing list
>Subject: Re: [Flashcoders] upload a file
>
>So i need to pass infos to another script (for example a php script) to

>upload the file?
>
>Lee McColl-Sylvester wrote:
>
>  
>
>>Yes, there is... Look up flash.net.FileReference.  It's for Flash 8
>>only, but it will support file browsing and sending... however, you
>>    
>>
>will
>  
>
>>need to manage the retrieval yourself on the server side.
>>
>>Lee
>>
>>
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf Of
>>    
>>
>Riccardo
>  
>
>>Roasio
>>Sent: 24 March 2006 09:50
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] upload a file
>>
>>Hi,
>>there is a way to open a "Open file dialog box" from an swf movie?
>>
>>I need to select a file to upload on the server but i don't want to
>>    
>>
>open
>  
>
>>an html page to do that...
>>
>>Thanks,Riccardo
>>
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
>> 
>>
>>    
>>
>
>_______________________________________________
>[email protected]
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>Brought to you by Fig Leaf Software
>Premier Authorized Adobe Consulting and Training
>http://www.figleaf.com
>http://training.figleaf.com
>_______________________________________________
>[email protected]
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>Brought to you by Fig Leaf Software
>Premier Authorized Adobe Consulting and Training
>http://www.figleaf.com
>http://training.figleaf.com
>  
>

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to