In this little tutorial we will show you how you 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 , so it can be tested locally … but the upload.php script can also be on any online webhosting.
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
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 on in other cases a online location).

Upload Script PHP
We now specify the location of this file to the URLRequest.

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
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 Complete Handler
Also interesting reads:
Hallo, das ist wirklich ein tolles Tutorial, danke.
Wichtig ist aber das man in die php datei z.B. ein echo “1″ steht..sonst wird der completeHandler nicht gefeuert.
But what if you want to have multiple files in a single “POST” to the server? Let’s say you’re interfacing with a REST API that requires multiple file inputs in a single POST. The method you’re describing is sending 2 “POST” requests to a URL.
Hi,
I have the same question.
What I want is in a php I will include this SWF and allow user to upload mutople files and I want to post all the files to a PHP page once and make a package out of the uploaded file and do something afterwords.
Please can you tell how to do that?
Thanks in advance.
Top-quality details pertaining to upload files for having myself get started. I most certainly will keep this specific website link and get back to this.