test if mp3 file exists on server and then show link

I have a record shop written in html and javascript and some php at http://www.trixysvinyl.com

heres the page im working on: http://www.trixysvinyl.com/info1.php?view=tv598

heres the php variable:


…which ill read from the URL.

I need some php code that looks to see if the following files are in the sf folder on the server


They will be sound samples ill record and store in the sf folder.

I need some php pcode which will look to see if any of these files exist in the sf folder and then display a link to them on the screen. The user then clicks the link and the web page will open up the mp3 in the default mp3 player and play it.

I guess Ill need a for…next loop for this.

I’m a newbie with php.

Any help appreciated - oh - and a free record from my shop under ?10 to the 1st person who gives me a successfull solution!!



This page shows an example of how to open and read the contents of a folder on the file system. From there on, you can just use substr() to see if each individual file in the folder starts with the value of your variable, and if so, proceed to take the appropriate action (like displaying a link to the file).

Sponsor our Newsletter | Privacy Policy | Terms of Service