Directory/File location and Downloading

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Directory/File location and Downloading

Postby TeaSquared » 08. February 2010 21:18

I am fairly new to Apache and i am having trouble researching and correcting an issue i am having...
--The issue is this.

I have a PHP page set up to display a list of files and then offer those files for people to download.
the directory path is this. --> /xampp/htdocs/the_store
However the PHP scripts are contain in this dir. --> /xampp/htdocs/scripts/php/
this is the parts of code that pertain to directory listings:
// $path = "/xampp/htdocs/the_store/";
// echo "<a href='/xampp/htdocs/the_store/$file'>$file</a><br/>";
(Note: PHP file is use is stored in /xampp/htdocs/scripts/php/)

The script displays the directory listing just fine however when i attempt to download
one of the files it gives me an error: Authroization required and it wants my xampp user/passwd.

I was able to get this to work by makeing the directory 'the_store' a sub directory of /xampp/htdocs/
and referencing it like this:
// $path = "the_store/";
// echo "<a href='the_store/$file'>$file</a><br/>";

This works and i am able to download files.

Now, If i leave the 'the_store' directory as a sub-directory and reference it by the full file path on my server:
I still get the same problem with authentication then being needed.

The problem is thus not directory possition but refernce method. How can i resolve this issue?
Notes: The page is after an authentication page. That part work by checking the session id of the user at
the beging of all PHP pages and redirects them if it does not match(i think)

I am also worried about security. Such as... The problem seems to occur because the full path is referenced which
includes the directorys that contain the xampp core files. So just giving anyone access to these dirs would be an issue.

Any advice on this would be much appreciated... I like my directories a certain way... :)
Posts: 1
Joined: 08. February 2010 20:06

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 94 guests