+ Reply to Thread
Results 1 to 8 of 8

Thread: Apache root ?

  1. #1
    Member
    Join Date
    Sep 2001
    Posts
    44

    Apache root ?

    A friend of mine wanted to be able to get some of my mp3's so I put up a simple page so he could download them. I wrote a PHP script that listed all my files in my htdocs dir and then made links to all the files so he could dL them. It worked fine when all the mp3's were in the htdocs(server root) dir, but when I made a sub dir called music in the htdocs dir he couldn't download them? I want to be able to just list the mp3's, not all the files in the htdocs. Do I have to mess with the conf file to allow multiple acsessable dirs?
    thanks
    Jutah

  2. #2
    Mntsnow
    Guest
    Needs to adjust the PHP script to work within the new folder. (Repoint where it looks for files)

  3. #3
    Member strangerstill's Avatar
    Join Date
    Sep 2001
    Location
    Oxford
    Posts
    203
    Post the script?

  4. #4
    Member
    Join Date
    Sep 2001
    Posts
    44
    Here is the script
    <?

    $dir_name = "C:\Program Files\Apache Group\Apache\htdocs\music";
    $dir = opendir($dir_name);
    $file_list = "<ul>";

    while($file_name = readdir($dir))
    {
    if(($file_name != ".") && ($file_name != ".."))
    {
    $file_list .= "<li><a href=/music/$file_name>$file_name</a>";
    }
    }

    $file_list .= "</ul>";

    closedir($dir);

    ?>

    <HTML>
    <HEAD>
    <TITLE> File Listing </TITLE>
    </HEAD>

    <BODY>

    <P> Files in: <? echo "$dir_name"; ?> </P>

    <? echo "$file_list"; ?>
    </BODY>
    </HTML>


    Thanks
    Jutah

  5. #5
    Member strangerstill's Avatar
    Join Date
    Sep 2001
    Location
    Oxford
    Posts
    203
    Sorry, guess I misunderstood you. Seeing as you wrote that script yourself, I asssume the problem isn't with rewriting the script, it's with giving the script permission to read the subdir & link to & dL files within that.

    I have zero experience with Apache. Oops. Sorry if I wasted your time there.

    OTOH, temporary workaround: keep the mp3s in the root folder and add this code:
    PHP Code:
    if(($file_name != ".") && ($file_name != "..") && ereg(".mp3",$file_name)) 

  6. #6
    Member
    Join Date
    Sep 2001
    Posts
    44
    Thanks for your help .

    Jutah

  7. #7
    Mntsnow
    Guest
    Jutah....Just noticed the name...

    You from Utah?

  8. #8
    Member
    Join Date
    Sep 2001
    Posts
    44
    No, I just got the name from "Point Break"

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







New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke