note 42574 added to function.is-uploaded-file

From: Date: Fri, 21 May 2004 20:58:54 +0000
Subject: note 42574 added to function.is-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-69924@lists.php.net to get a copy of this message
Before moving the file in to place it's also a good idea to check if file with the same name already exists on the server. If file exists then create unique name for the new file. $num=1; while (file_exists($destination)){ $num++; // if previous file name existed then thy another number+_+filename $file_name = $num."_".$_FILES['userfile']['name']; $destination = $uploadpath.$file_name; } move_uploaded_file( $source, $destination ); ---- Manual Page -- http://www.php.net/manual/en/function.is-uploaded-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42574 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42574&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42574&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69924) next »