Jump to content

reading folder


Recommended Posts


i am a making a site in which m saving a songs information in database then fetching that out for inserting song link m using readdir function that read all song in a folder then save them in database

but i have problem

when that read file name

.mp3 also include with that which i don't want to show on page where i fetch that

mean simply i want that i can insert song name separately and file separately... and i want to use readdir also for getting file name becoz that easy way instead of upload through panel ..? any idea or solution about adding separately file name

Link to comment
Share on other sites

after writing this code

$dir = "A Flat";
$open = opendir($dir);

while(false !== ($read = readdir($open))){
    if($read != '.' && $read != '..'){
    echo $read."<br />";}

out is this


01 - Meetha Sa Ishq.mp3
02 - Dil Kashi.mp3
03 - Chal Halke Halke.mp3
04 - Pyar Itna Na Kar.mp3
05 - Meetha Sa (unplugged).mp3
06 - Dil Kashi.mp3
07 - Meetha Sa (partymap mix).mp3

full file name

i will insert these data in table song in link column

but i need also the name of songs for inserting in name colum which i show on page to show people name of songs

because if the same name i put in name field so .mp3 will be with every name that will not look good

so how i add also separete name of these songs which will be in directory

Link to comment
Share on other sites


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

  • 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.