rename file and store in php code example
Example 1: rename file php
rename('old_filename.txt', 'new_filename.txt');
Example 2: php how to rename a file before saving it
$temp = explode(".", $_FILES["file"]["name"]);
$newfilename = round(microtime(true)) . '.' . end($temp);
move_uploaded_file($_FILES["file"]["tmp_name"], "../img/imageDirectory/" . $newfilename);