Rename file with current date, after upload

mluci12
Posts: 39

Rename file with current date, after upload

How can i rename file with current date ( month/years/minute/secondes.file_extension ) in the code from:
file-upload-script-not-work-t214.htm#p687

Admin
Try to use the code from this example:

Code: Select all

$fname ='file-name.ext'; $set_name = date('Y-m-d-H-i-s'); $fname = preg_replace('/(.+?)\.([^\.]+)$/i', $set_name .'.$2', $fname); echo $fname; // 2016-10-25-18-35-56.ext

Similar Topics