Re: move_uploaded_file() does not return any value or warning

From: Date: Sat, 15 Oct 2011 03:28:48 +0000
Subject: Re: move_uploaded_file() does not return any value or warning
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-315309@lists.php.net to get a copy of this message
On 15/10/11 08:35 AM, Simon J Welsh wrote:
Assuming you did $move_uploaded_file = move_uploaded_file($filename, $destination);, then isset($move_uploaded_file) will always be true. isset() just checks if the variable you past to it is set, not if it has a non-false value. You could simply use if(move_uploaded_file($filename, $destination)), or if($move_uploaded_file). My apologies - i forgot to include the $move_uploaded_file = move_uploaded_file($filename, $destination); line.
I saw in the manual that isset() "isset --- Determine if a variable is set and is not NULL" and thought if move_uploaded_file() returns false, the error checking will be triggered.But now i see the sample code in the manual and stand corrected. So what was happening that $move_uploaded_file was set but empty.My understanding of isset() was wrong. * *

« previous php.general (#315309) next »