Comparison between string failing
| From: | mweb | Date: | Fri, 07 Dec 2001 22:51:53 +0000 |
| Subject: | Comparison between string failing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77088@lists.php.net to get a copy of this message | ||
Hello,
I can't understand why the piece of test code below produces the output :
OK HERE
VALUE 0:image/pjpeg;
UPLOAD FAILED = ;
VALUE =1:image/pjpeg;
Basically I use or print several times the value
$MYFILES['file_recensione']['tmp_name'][1]
and it looks like it changes values from line to line (it's not a scope
thing, I'm almost sure in this case: what is below is the whole file). Look
at the line below with the string "ESTENSIONE", it should be printed instead
of UPLOAD FAILED, right?
Why doesn't it happen?
mweb
//////////////////////////////////////////////////////////////////////////////////////////////////
global $MYFILES;
$MYFILES['file_recensione']['tmp_name'][1] = 'image/pjpeg';
if ($MYFILES['file_recensione']['tmp_name'][1] == 'image/pjpeg')
{print "OK
HERE<HR>";}
print "VALUE
0:".$MYFILES['file_recensione']['tmp_name'][1].";<HR>";
if (/*is_uploaded_file($MYFILES['file_recensione']['tmp_name'][1])*/
//($VAL == 1) && (
($MYFILES['file_recensione']['type'][1] == 'image/jpeg') ||
($MYFILES['file_recensione']['type'][1] == 'image/pjpeg') ||
($MYFILES['file_recensione']['type'][1] == 'image/gif')
// )
) {
$EXTGIF = 'jpg';
if (substr($MYFILES['file_recensione']['type'][1], -3) == 'peg')
{
$EXTGIF = 'jpg';}
if (substr($MYFILES['file_recensione']['type'][1], -3) == 'gif')
{
$EXTGIF = 'gif';}
print "ESTENSIONE = $EXTGIF;<BR>";
} else {print "UPLOAD
FAILED<BR>".$MYFILES['file_recensione']['type'][1].";<BR>";}
print "VALUE
=1:".$MYFILES['file_recensione']['tmp_name'][1].";<HR>";