Re: comparison operators

From: Date: Sun, 20 May 2001 09:59:37 +0000
Subject: Re: comparison operators
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53601@lists.php.net to get a copy of this message
Hi: For compare strings you can use strcmp. $st1 = "hi"; $st2 = "bye"; if (strcmp($st1, $st2)) { echo "are different"; } else { echo "are equal"; } The strcmp return 0 when the strings are equal. If the strings are diferent, return the pos of the char where begin the diference. I think you can use this without problems. ******************** I can see that you upload files. My problem it's that i can do it. Y use the form like this. <form enctype="multipart/form-data" action="subirfichero.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="1000">Send this file: <input name="dd" type="file"> <input type="submit" value="Send File"> </form> My problem is that i don't know how to do the php program that i upload the file. Can you help me?. Thanks. Best Regards Diego Heidi Belal escribió: > Hi All! > i'm creating this form for people to upload pictures, > so i want to be able to compare the type of the file, > so that if it's not a .gif or a .jpg i give them an > error message! > What i am using is: > > If ($userfile_type == "image/gif") > - here it uploads the file > otherwise it sends out an error message! > > but the problem i'm having is that even when i try > uploading a .txt it accepts it and uploads it without > giving the error message. > Is there another way to compare strings? or is == > operater correct? or what am i doing wrong? > thanks! > > ===== > Heidi Belal > ICQ# 32127109 > > A bus stops at a bus station. > A train stops at a train station. On my desk > I have a work station... > > __________________________________________________ > Do You Yahoo!? > Yahoo! Auctions - buy the things you want at great prices > http://auctions.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#53601) next »