Saturday, November 19, 2011

Remove .mp3 or .wmv from the filename display (php script)?

Please see this question for the details.


http://uk.answers.yahoo.com/question/?qi...





what they suggested removes the .mp3 bit, but the one thing I didnt point out is that the hyperlink is reliant on the filename, i.e. if i remvoe the .mp3 from file.mp3, the hyperlink is also file - which then doesnt do the job.





Suggestions please

Remove .mp3 or .wmv from the filename display (php script)?
Instead of using


$fn = substr($fn, 0, strrpos($fn,"."));





use


$fnd = substr($fn, 0, strrpos($fn,"."));





Then you have the original filename as $fn, while the displayed filename is $fnd.





Simple!





Sorry about the mistake in my post on that answer, I forgot that strrpos deals with the last instance of a character.


No comments:

Post a Comment