Re: Comparison between string failing

From: Date: Sat, 08 Dec 2001 02:08:57 +0000
Subject: Re: Comparison between string failing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77096@lists.php.net to get a copy of this message
I would like to start by saying that your code is horribly confusing. Try taking all those commented out parts out of the script before you post to the group. That said, your problem is that you left out a closing curly brace. Try this: > 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';}} // ******ADDED CLOSING BRACE******* > 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>"; Mweb <mweb@inwind.it> wrote in message news:php.general-77088@news.php.net... > 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>";

« previous php.general (#77096) next »