This is not the most flashy code but it works for me. I upload images and during upload, the script renames the image filename for use by other scripts that I run.
$upload1tmp = $_FILES['upload1']['tmp_name'];
$dest_path = $dest_dir.$dproperty."a.jpg";
if (is_uploaded_file($upload1tmp))
{
if (copy($upload1tmp, $dest_path))
{
echo("<tr><th>Upload Status<th>Client File Name<th>Image File Size</tr>");
echo "<tr><td align=center>Succeeded!</td>";
echo "<td align=center>".$FILES['upload1']['name']."</td>";
echo "<td align=center>".$FILES['upload1']['size']."</td></tr>";
}
}
The dproperty variable holds the contents of the row['ID'] and it's passed via the calling php script. I wanted the row ID to name the image filename.
Hope that helps. I'm sure their are better ways to accomplish the same thing but it works.