Can I extract the three-letter file extension from {$attachment['filename']}?
#1
As the title says, I'm trying to return the "mp3" bit of a "MyAudioFile.mp3" filename within the html of one of my forum Templates. Any ideas?

From my Googling and forum searching so far, it looks as if I might need some extra PHP code somewhere using something like "substr(-3)", but I'm a newb to that kind of coding so if there's an easier way (or if there's a simple code module someone could recommend that I could paste in), then I'd be interested to know about it.
Reply
#2
if (preg_match("/\(.*?)mp3/is", $post['attachment']))	// Verify if it is a real mp3 file
			{
// do something here
}
else
{
// What you want it to do if it isn't
}

You'd need to have that use on of the hooks; I'm not positive which one offhand.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)