Jump to content


Photo

using IF with multiple results?


  • Please log in to reply
3 replies to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 18 April 2006 - 05:58 PM

if ($_FILES['userfile']['type'] == 'wmv' or 'mpg' or 'mpeg' or 'avi'){

how can i make that work? Thanks
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 magnav0x

magnav0x
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 April 2006 - 06:48 PM

[!--quoteo(post=366101:date=Apr 18 2006, 12:58 PM:name=joecooper)--][div class=\'quotetop\']QUOTE(joecooper @ Apr 18 2006, 12:58 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
if ($_FILES['userfile']['type'] == 'wmv' or 'mpg' or 'mpeg' or 'avi'){

how can i make that work? Thanks
[/quote]

Something like:

if ($_FILES['userfile']['type'] == 'video/x-ms-wmv ' || $_FILES['userfile']['type'] == 'video/mpeg' || $_FILES['userfile']['type'] == 'video/x-msvideo'){

video/mpeg will handle MPG and MPEG.
video/x-msvideo will handle AVI
video/x-ms-wmv will handle WMV (not sure about this one)

I'm not positive on the WMV one, but it may be right. You need to know the mime types associated with the files you are comparing against.

#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,020 posts

Posted 18 April 2006 - 07:06 PM

alternatively

$goodType = array ('video/x-ms-wmv ','video/mpeg','video/x-msvideo');

if (in_array($_FILES['userfile']['type'], $goodType)) {

        # process file
}

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 inztinkt

inztinkt
  • Members
  • PipPip
  • Member
  • 21 posts
  • LocationCyprus ( OnThisIsland )

Posted 18 April 2006 - 07:09 PM

Once again, Barand you've tawt me somethin new, didnt knw u culd check arrays like tht. thanks :)
<!-- // Blah // -->
OnThisIsland.com

The greatest leader is not always he who holds the most power, but he who has the ability to do the most with the power he has. - Inztinkt is Distinct!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users