Jump to content

Archived

This topic is now archived and is closed to further replies.

joecooper

using IF with multiple results?

Recommended Posts

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

how can i make that work? Thanks

Share this post


Link to post
Share on other sites
[!--quoteo(post=366101:date=Apr 18 2006, 12:58 PM:name=joecooper)--][div class=\'quotetop\']QUOTE(joecooper @ Apr 18 2006, 12:58 PM) [snapback]366101[/snapback][/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.

Share this post


Link to post
Share on other sites
alternatively

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

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

        # process file
}[/code]

Share this post


Link to post
Share on other sites
Once again, Barand you've tawt me somethin new, didnt knw u culd check arrays like tht. thanks :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.