Please help

hii i have a database field which contains link. like this…

/downloads/songs/Bangla/Band/artist/album/song.mp3

How can i get only

downloads/songs/Bangla/Band/artis/album/ in a variable

that i can write xml file to that directory link. here the above link will be before playlist.xml.


$file= fopen("playlist.xml", "w");


anyone can help me please.

You can use the PHP function dirname for this purpose. It will give you the name of the directory in which the file resides.

You could also use [fphp]pathinfo[/fphp].


<?php
$path = pathinfo(
  '/downloads/songs/Bangla/Band/artist/album/song.mp3',
  PATHINFO_DIRNAME
);