Directory problem

Directory problem

am 22.08.2007 19:23:26 von Shelly

When I upload pictures I put them into a directory structure such as

photos/1000/1/Jon.jpg

where 1000 is the account number of the customer and 1 is the agentID of the
particular customer employee who requested it be put there.

To view the files I do a directory search (code after this explanation) to
build a list, $filelist, that I will put up in the html area with a echo $filelist ?>

The result of all this is that it finds the one file that is that directory
(Jon.jpg) and prints it out the link and the name (see code below).
However, when I click on it to actually view the picture, it gives a page
not found. What I don't understand is why this is happening when I got the
name from the directory search.

Data in the form
$TOP ="http://www.mywebsite.com/";
$accountNumber = 1000;
$agentID = "1";
$authCode = "something"; // This is for later when I check against a
database to validate permissions)

Code:
$accountNumber = $_POST['accountNumber'];
$agentID = $_POST['agentID'];
$authCode = $_POST['authCode'];

$empty = (strlen($accountNumber) == 0) && (strlen($agentID) == 0) &&
(strlen($authCode) == 0);
$ok = false;
if (isset($_POST['viewPic']) && !$empty) {
$ok = true;
$dir = "photos/" . $accountNumber . "/" . $agentID;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$filelist .= '' .
$file . "

";
}
}
closedir($handle);
}
}

?>

The view source gives:


So, the directory search finds it to build the link, but I a get a page not
found on the click. Any ideas? (It is probably something so simple that it
is a DUH!, but I have not been able to see it).

--
Shelly

Re: Directory problem

am 22.08.2007 19:39:22 von Shelly

"Shelly" wrote in message
news:13cos8tbmnkvjc7@corp.supernews.com...
> When I upload pictures I put them into a directory structure such as

The problem is not in the code I presented. I ran a simple test by creating
a test.htm that simply echoed "testing".

I then tried:
http://www.myserver.com/photos/1000/1/test.htm
http://www.myserver.com/photos/1000/test.htm
http://www.myserver.com/photos/test.htm
http://www.myserver.com/test.htm

after putting it in all those places. Only the last one did not give me a
page not found, so I suspect it has something to do with access rights to
photos directory.

Sorry for troubling you.

--
Shelly

Re: Directory problem

am 22.08.2007 20:30:30 von Shelly

That was it, the old permissions trick.

--
Shelly