Flash php image upload-change image name

hi,
i’m not really a php guy and was hoping someone could help me out with this. i have a from that is called from flash that uploading an image(from flash 8). what i want it to do is change the name of the image file file before uploading/moving the file and have that new file name returned to flash. i think all of this can be done on the php side before flash even gets the file name but i’m not positive about that. here’s the php code:

<?php
//create the directory if doesn’t exists (should have write permissons)
if(!is_dir("./files")) mkdir("./files", 0755);
//move the uploaded file
move_uploaded_file($_FILES[‘Filedata’][‘tmp_name’], “./files/”.$_FILES[‘Filedata’][‘name’]);
chmod("./files/".$_FILES[‘Filedata’][‘name’], 0777);
?>

i figure that the name could be changed before the move_uploaded_file is called but i’m not sure how to do it.

thanks in advance for the help.