Help with flash 8 upload/download using php

I am trying to get this source working on my server

I original files were in coldfusion but I could get it to work on my server. I am now trying it with php.

this is what I did…

deleted out viewFiles.cfm and uploadFiles.cfm files
replaced them with , uploadFiles.php which works fine

then made a viewFiles.php with this code

$xmlOutput = '~?xml version="1.0" encoding="UTF-8"?^~row^';
while ($file = readdir($handle)) {
	if(!is_dir($file) && !is_link($file)) {
$xmlOutput .= '~file name="' . $file . '" size="' . filesize("userUploads/" . $file) . '" path="userUploads/' . $file . '" /^';
$xmlOutput .= '~/row^'; 
header("Content-type: text/xml");
echo $xmlOutput;

Then changed the two links in as file to point to these new php files
and then changed the two links in the index.html file to point to the new files.
uploaded all files and
then cmoded the userUploads folder to 777

---- when I tested it I can upload files fine and I can see them in the userUploads folder on my server,but cannot view these files in the download section nor download them.

Any suggestions