php how to rename a file before saving it

Solutions on MaxInterview for php how to rename a file before saving it by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "php how to rename a file before saving it"
Michela
02 Mar 2016
1$temp = explode(".", $_FILES["file"]["name"]);
2$newfilename = round(microtime(true)) . '.' . end($temp);
3move_uploaded_file($_FILES["file"]["tmp_name"], "../img/imageDirectory/" . $newfilename);