Jump to content

If state using file extensions


skyer2000

Recommended Posts

(sorry title is supposed to read "If statement using file extensions")

I'm trying to figure this out for my media website. I've got 2 types of videos to display, either .flv or .wmv. What I'm trying to figure out is a "if" statement i could use so that if the file ends in .wmv, it will display one way, else it will display another way for the .flv files.

Thanks in advance!
Link to comment
Share on other sites

Use the [a href=\"http://www.php.net/pathinfo\" target=\"_blank\"]pathinfo[/a]() function to get the extension:
[code]<?php
$pi = pathinfo($filename);
switc $pi['extenson'] {
   case 'flv':
//
// do the flv processing
//
   break;
   case 'wmv':
//
// do the wmv processing
//
   break;
}
?>[/code]

Ken
Link to comment
Share on other sites

[!--quoteo(post=350780:date=Mar 1 2006, 04:12 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 1 2006, 04:12 PM) [snapback]350780[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Use the [a href=\"http://www.php.net/pathinfo\" target=\"_blank\"]pathinfo[/a]() function to get the extension:
[code]<?php
$pi = pathinfo($page['url']);
switch($pi['extenson']) {
   case 'wmv':
//
// do the wmv processing
//
   break;
   case 'flv':
//
// do the flv processing
//
   break;
}
?>[/code]

Ken
[/quote]

I had to edit the code a tad to get rid of errors, but now it just displays the page without anything between the "case 'wmv';" and the first "break", even when the $page['url'] calls up the filename (movie.wmv). Any ideas?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.