sorry forgot what i needed help with, this is what im trying to do.
i want to upload a text file from a webpage into a specified web dir, and i want to rename the file to articles.txt, if that exists, i want to rename it to articles1.txt, if that exist i want to rename it to articles2.txt,.. any help would be great, thanks!
<?
$fname = "article";
$fext = ".txt";
$newname = $fname . $fext;
$testname = "article.txt";
//checks for file upload
if(isset($UploadedFile))
{
//uploads file
copy($UploadedFile, $UploadedFile_name);
//renames file to article.txt
rename($UploadedFile_name, "article.txt");
//checks if if article.txt already exists
//after this point i need help
if (file_exists($newname)) {
while (file_exists($newname)){
$number++;
$fname = $fname . $number;
$newname = $fname . $fext;
} //end of while loop
} //end of if statement
//file information
print("Local File: $UploadedFile <BR>\n");
print("Name: $UploadedFile_name <BR>\n");
print("Size: $UploadedFile_size <BR>\n");
print("Type: $UploadedFile_type <BR>\n");
print("<HR>\n");
}
?>