SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: please help...

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

    PHP Code:
    $filefopen("playlist.xml""w"); 
    anyone can help me please.

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2010
    Location
    Netherlands
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the PHP function dirname for this purpose. It will give you the name of the directory in which the file resides.

  3. #3
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You could also use pathinfo.
    PHP Code:
    <?php
    $path 
    pathinfo(
      
    '/downloads/songs/Bangla/Band/artist/album/song.mp3',
      
    PATHINFO_DIRNAME
    );
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •