www.webdeveloper.com
Results 1 to 3 of 3

Thread: help me to solve this!

  1. #1
    Join Date
    Dec 2003
    Location
    Malaysia
    Posts
    206

    Exclamation help me to solve this!

    i have a website which written in php and let users downloads files from my server .. and i do have a admin site to manage all the download files (includes:- upload, descriptions of files, delete files or delete folders)

    now i have a problems ... if there are 10 persons who accessing my folder named "MP3/ENGLISH/" and they are downloading "U2.mp3" ... AND I WANT TO DELETE THE FOLDER MP3 .. it doesn't allowed cos someone is accessing the folder ... is there any way to check if there are connections currently accessed this folder, and reset all the connections using PHP?


    pls help

  2. #2
    Join Date
    Dec 2002
    Location
    Seattle, WA
    Posts
    1,843
    if you are using rmdir(), the directory must be empty first, otherwise you get an error

    you would need to do something like this:
    PHP Code:
    <?php
    $dir 
    "/MP3/ENGLISH";
    chdir($dir);
    $dh opendir($dir);

    while((
    $file readdir($dh)) !== false)
    {
        if(
    $file != '.' && $file != '..')
        {
            
    unlink($file);
        }
    }
    closedir($dh);
    rmdir($dir);
    ?>
    Last edited by ShrineDesigns; 11-23-2004 at 11:10 PM.

  3. #3
    Join Date
    Dec 2003
    Location
    Malaysia
    Posts
    206
    i know how to remove the folder .. i even write a function that remove a folder which content files inside ..

    but i don't know how to remove a folder which one of the file inside that folder are currently accessed by someone ..

    file in used .. we can't delete it write?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles