Hello,

So what I need is to add something to the code below that changes the file name to something random and uploads it as that random file name.

This is what i have. What do i have to add to it to make it change the file name to something random?


<?php
// ==============
// Configuration
// ==============
$uploaddir = "upload"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777!
$allowed_ext = "swf, SWF"; // These are the allowed extensions of the files that are uploaded
$max_size = "5000000"; // 50000 is the same as 50kb
$max_height = ""; // This is in pixels - Leave this field empty if you don't want to upload images
$max_width = ""; // This is in pixels - Leave this field empty if you don't want to upload images

// Check Entension
$extension = pathinfo($_FILES['file']['name']);
$extension = $extension[extension];
$allowed_paths = explode(", ", $allowed_ext);
for($i = 0; $i < count($allowed_paths); $i++) {
if ($allowed_paths[$i] == "$extension") {
$ok = "1";
}
}

// Check File Size
if ($ok == "1") {
if($_FILES['file']['size'] > $max_size)
{
print "Flash file size is too big! (maximum file size 4.5 megabytes)";
exit;
}

// Check Height & Width
if ($max_width && $max_height) {
list($width, $height, $type, $w) =
getimagesize($_FILES['file']['tmp_name']);
if($width > $max_width || $height > $max_height)
{
print "Flash file height and/or width are too big!";
exit;
}
}

// The Upload Part
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
}
print "Your files have been uploaded successfully! Thank you for submitting your flash game to GameRinger! We will contact you soon regarding how you would like to be recognized for your game submission.";
} else {
print "File extension is not permitted!";
}
?>

THANKS IN ADVANCE!