Upload Multiple Files in Flash CS3

In this little tutorial i will show you how we can upload one or more file(s) using the FileReferenceList in Flash CS3.

We will use amfphp to upload the image to a location on our server … if you do not have amfphp installed, check out my prevouis post …

We will begin by declaring a new FileReferenceList object … after that we will set the object to show the browse window to select the files that need to be uploaded.

We also need to listen for the select event , this event is triggerd whenever enter is pressed, or the select button is clicked from the upload component.

Creating a new FileReferenceList

Creating a new FileReferenceList

Now we specify the upload destination location, hereby i use a php file that uploads the file from the uploadReferenceList to the location specified in the php file (a directory on our amfphp server).

Upload Script PHP

Upload Script PHP

Now having than that, we now specify the location of this file in Flash.

Upload Script Location

Upload Script Location

Now , this is what the fileSelectHandler looks like, we will loop through the fileList of the FileReference (so all the files we selected for upload), and push them into a custom function uploadSingleFile….

Select Handler

Select Handler

Here we just upload the file that was passed into the function to the php file on our amfphp server …

We also add a complete handler , so can trigger an action for the upload complete event.

Upload Single File

Upload Single File

Upload Complete Handler

Upload Complete Handler

1 comment so far

  1. Fletch on

    is the PHP file listed in this tutorial a script that goes into the AMFPHP services folder or is it being run completely independent from AMFPHP?


Leave a reply