File Upload Using Flash 8

No one seems to respond in the Flash 8 forum… So here I am, please help thank you…

Does any body know how to get this dam code to upload video files as well. Every tut I come accross with Flash 8 upload is dealing with uploading images only …HELP HELP HELP

Here is the PHPH Code.

<?php

$MAXIMUM_FILESIZE = 1024 * 200; // 200KB
$MAXIMUM_FILE_COUNT = 10; // keep maximum 10 files on server
echo exif_imagetype($_FILES[‘Filedata’]);
if ($_FILES[‘Filedata’][‘size’] <= $MAXIMUM_FILESIZE) {
move_uploaded_file($_FILES[‘Filedata’][‘tmp_name’], “./temporary/”.$_FILES[‘Filedata’][‘name’]);
$type = exif_imagetype("./temporary/".$_FILES[‘Filedata’][‘name’]);
if ($type == 1 || $type == 2 || $type == 3) {
rename("./temporary/".$_FILES[‘Filedata’][‘name’], “./images/”.$_FILES[‘Filedata’][‘name’]);
} else {
unlink("./temporary/".$_FILES[‘Filedata’][‘name’]);
}
}
$directory = opendir(’./images/’);
$files = array();
while ($file = readdir($directory)) {
array_push($files, array(’./images/’.$file, filectime(’./images/’.$file)));
}
usort($files, sorter);
if (count($files) > $MAXIMUM_FILE_COUNT) {
$files_to_delete = array_splice($files, 0, count($files) - $MAXIMUM_FILE_COUNT);
for ($i = 0; $i < count($files_to_delete); $i++) {
unlink($files_to_delete[$i][0]);
}
}
print_r($files);
closedir($directory);

function sorter($a, $b) {
if ($a[1] == $b[1]) {
return 0;
} else {
return ($a[1] < $b[1]) ? -1 : 1;
}
}
?>


// Flash code from sample app in Flash 8…
//****************************************************************************
//Copyright © 2005 Macromedia, Inc. All Rights Reserved.
//The following is Sample Code and is subject to all restrictions on
//such code as contained in the End User License Agreement accompanying
//this product.
//****************************************************************************

System.security.allowDomain(“http://www.helpexamples.com”);
import flash.net.FileReference;

// The listener object listens for FileReference events.
var listener:Object = new Object();

// When the user selects a file, the onSelect() method is called, and
// passed a reference to the FileReference object.
listener.onSelect = function(selectedFile:FileReference):Void {

// Update the TextArea to notify the user that Flash is attempting to
// upload the image.
statusArea.text += "Attempting to upload " + selectedFile.name + "
";

// Upload the file to the PHP script on the server.
selectedFile.upload(“upload.php”);
};

// When the file begins to upload the onOpen() method is called, so
// notify the user that the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void {
statusArea.text += "Opening " + selectedFile.name + "
";
};

// Once the file has uploaded, the onComplete() method is called.
listener.onComplete = function(selectedFile:FileReference):Void {

// Notify the user that Flash is starting to download the image.
statusArea.text += "Downloading " + selectedFile.name + " to player
";

// Add the image to the ComboBox component.
imagesCb.addItem(selectedFile.name);

// Set the selected index of the ComboBox to that of the most recently-
// added image.
imagesCb.selectedIndex = imagesCb.length - 1;

// Call the custom downloadImage() function.
downloadImage();
};

var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);

uploadBtn.addEventListener(“click”, uploadImage);
imagesCb.addEventListener(“change”, downloadImage);
imagePane.addEventListener(“complete”, imageDownloaded);

// If the image does not download, the event object’s total property
// will equal -1. In that case, display a message to the user.
function imageDownloaded(event:Object):Void {
if(event.total == -1) {
imagePane.contentPath = “Message”;
}
}

// When the user selects an image from the ComboBox, or when the downloadImage()
// function is called directly from the listener.onComplete() method,
// the downloadImage() functino sets the contentPath of the ScrollPane in order
// to start downloading the image to the player.
function downloadImage(event:Object):Void {
imagePane.contentPath = “images/” + imagesCb.value;
}

// When the user clicks the button Flash calls the uploadImage() function,
// and it opens a file browser dialog.
function uploadImage(event:Object):Void {
imageFile.browse([{description: “Media Files”, extension: “.mov;.swf;.jpg;.gif;*.png”}]);
}