Re: [PHP] move_uploaded_file() does not return any value or warning
On 15/10/2011, at 4:01 PM, Partha Chowdhury wrote: Then i set a check for the return value of move-uploaded_file. if(isset ($move_uploaded_file)): echo success; else: echo error in uploading; endif; But it does not print anything ! 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). --- Simon Welsh Admin of http://simon.geek.nz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file() does not return any value or warning
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. * *