Jump to content

reading folder


realcoder

Recommended Posts

hi

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