i'm back with my upload script. Now i want to know how i can check for unique file names. I added a timestamp so that if the file name is the same then it puts the thing on. But it does this for every file name regardless. Any easy suggestions on how to only add the stamp for filenames that already exisit?
<?php
$uploaddir = '/usr/sites/stupidgamers.com/txt/';
$uploadfile = $uploaddir .microtime(). str_replace(' ','',$_FILES['userfile']['name']);
$filetype = $_FILES['userfile']['type'];
$filetemp = $_FILES['userfile']['tmp_name'];
$filename = $_FILES['userfile']['name'];
$filesize = $_FILES['userfile']['size'];
if($filetype != "text/plain" || $filesize > 100000) {
print "Invalid file extension or filesize too large. The file $filename was not uploaded.";
exit;
}
else
{
if (move_uploaded_file($filetemp, $uploadfile))
{
print "File Uploaded.";
}
else
{
print "Cannot Upload.";
}
}
?>