This is so easy. I made a succesful AMFPHP multi file upload wich I’m using in my new release of the Rive.be CMS (clear your browser cache), by using this as a base. You can read all about it at Gertons’s blog (single file upload) and the Flex{er} blog (his multi file example didn’t work). So in the end if you throw these 2 examples together (merge them somehow) you should end up with a working solution.

Basically you have enough with these 2 snippets to upload any file you wish to a AMFPHP backend.

fileRef.addEventListener(Event.COMPLETE, handleFileLoadedComplete);
fileRef.load();
 
protected function handleFileLoadedComplete(e:Event):void
{
var data:ByteArray = new ByteArray();
var fileRef:FileReference = e.target as FileReference;
fileRef.data.readBytes(data, 0, fileRef.data.length);
var bytearray:ByteArray = data;
var fileName:String = fileRef.name
//this ByteArray & fileName you have to pass trough to the AMFPHP Service
}
public function uploadFile($fileName, $byteArray)
{
file_put_contents( $fileName, $byteArray);
}