Use this code to rename the file automatically :-

Instead of
move_uploaded_file($_FILES["file"]["tmp_name"], "../img/imageDirectory/" . $_FILES["file"]["name"]);
Use
$temp = explode(".", $_FILES["file"]["name"]);
$newfilename
= round(microtime(true)) . '.' . end($temp);
move_uploaded_file
($_FILES["file"]["tmp_name"], "../img/imageDirectory/" . $newfilename);
Changed to reflect your question, will product a random number based on the current time and append the extension from the originally uploaded file.