473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Directory problem

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 <?php
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:
<?php
$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 .= '<a href="' . $TOP . $dir . "/" .$file . '">' .
$file . "</a><br>";
}
}
closedir($handle);
}
}

?>

The view source gives:
<a href="http://www.mywebsite.com/photos/1000/1/Jon.jpg">Jon.jpg</a>

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
Aug 22 '07 #1
2 1181
"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@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
Aug 22 '07 #2
That was it, the old permissions trick.

--
Shelly
Aug 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take...
11
by: Etienne Charland | last post by:
Hi, I have a solution containing 6 C# projects; 1 WinForms project and 5 class libraries. I didn't have any problems until recently. I added a new project containing reports. I am using...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
3
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
2
by: Danny Miller | last post by:
Hi there, I'm facing a problem that is driving me nuts. The scenario is as follows: 1) Create an empty directory structure e.g. C:\Dev1\TestWebApp 2) Map a virtual directory e.g. TestWebApp...
9
by: Benny Ng | last post by:
Hi,all, How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem....
28
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
0
by: Matt MacDonald | last post by:
Hi all, I'm having a really frustrating problem. I have a web application that needs to modify the directory structure of the underlying files. The problem I'm having is that after the system...
13
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.