I have a simple piece of code for uploading the files in php/mysql and it works well.
$target = "uploads/clients/";
$target = $target . basename( $_FILES['photo']['name']);
$pic=($_FILES['photo']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
$insertSQL = sprintf("INSERT INTO clients (img, `cname`) VALUES (%s, %s)",
GetSQLValueString($pic, "text"),
GetSQLValueString($_POST['cname'], "text"));
mysql_select_db($database_thebest, $thebest);
$Result1 = mysql_query($insertSQL, $thebest) or die(mysql_error());
Now what I want is to rename the filename if that filename already exists and then insert the renamed filename to the database
Thanks for your reply