You only need one button. OK well then... here is a direct copy and
paste from the help docs.  If you need help with Actionscript, then this
probably isn't the list from you, you might want to subscribe to
Flashnewbies at chattyfig.figleaf.com.  Hope that helps.

 

        To upload files to a server, first call the browse() method to
allow a user to select one or more files. Next, when the
FileReference.upload() method is called, the selected file will be
transferred to the server. If the user selected multiple files using the
FileReferenceList.browse() method, Flash Player creates an array of
selected files called FileReferenceList.fileList. You can then use the
FileReference.upload() method to upload each file individually.

NOTE

 

Using the FileReference.browse() method allows you to upload single
files only. To allow a user to upload multiple files, you must use the
FileReferenceList.browse() method.

        By default, the OS file picker dialog box allows users to pick
any file type from the local computer, although developers can specify
one or more custom file type filters by using the FileFilter class and
passing an array of file filter instances to the browse() method:

        var imageTypes:FileFilter = new FileFilter("Images (*.jpg,
*.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
        var textTypes:FileFilter = new FileFilter("Text Files (*.txt,
*.rtf)", "*.txt; *.rtf");
        var allTypes:Array = new Array(imageTypes, textTypes);
        var fileRef:FileReference = new FileReference();
        fileRef.browse(allTypes);
        

        When the user has selected the files and clicked the Open button
in the OS file picker, the Event.SELECT event is dispatched. If the
FileReference.browse() method was used to select a file to upload, the
following code is needed to send the file to a web server:

        var fileRef:FileReference = new FileReference();
        fileRef.addEventListener(Event.SELECT, selectHandler);
        fileRef.addEventListener(Event.COMPLETE, completeHandler);
        try {
            var success:Boolean = fileRef.browse();
        } catch (error:Error) {
            trace("Unable to browse for files.");
        }
        function selectHandler(event:Event):void {
            var request:URLRequest = new
URLRequest("http://www.[yourdomain].com/fileUploadScript.cfm";)
            try {
                fileRef.upload(request);
            } catch (error:Error) {
                trace("Unable to upload file.");
            }
        }
        function completeHandler(event:Event):void {
            trace("uploaded");
        }
        

Reply via email to