note 38368 added to function.rename

From: Date: Thu, 18 Dec 2003 12:23:54 +0000
Subject: note 38368 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-62170@lists.php.net to get a copy of this message
this code will help you rename a file, without taking care of it's extension. for example if you have a comunity website, and the user uploads it's picture, you'll probably want the name of the image to be unique... like the user, or maybe the image will take the name of the user...: $rename = 'new_name'; //or $rename = $username; $file_name = $_FILES['userfile']['name']; $read_extension = explode(".", $file_name); $ext = $read_extension[1]; $renamed = $rename.".".$ext; rename($file_name, $renamed); ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38368 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38368&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38368&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62170) next »