ive got a php script that allows me to upload a file, to my specified folder. but i would like the script to rename the file before it is placed in the folder so it is the same as my productid. is it even possible to rename it, or would i have to rename the file before uploading it. heres my upload script if that helps.
<?php
// Where the file is going to be placed
$target_path = "prt1/images/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
$target_path = "prt1/images/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>