A: 

Replace:

echo "<a href=\"$file\">$file</a><br />";

with:

echo "<a href=\"".$path."/".$file."\">$file</a><br />";

The string returned by readdir is the file name not the file path so you have to add the folder path before the filename

mck89
You mean $path inside the href rather than the anchor I think.
Laykes
Yeah sorry i've updated it
mck89
@mck89 I tried the above I now get the full file path, which looks untidy lol, but it still says "object not found"
declan
sorry it jumped ahead! i now tried the updated version and I now get this "Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program."what does that mean??
declan
-1, this wont solve the problem until `c:/users/jon/desktop/pictures` is not in the web folder, or can be reached by the web.
DaNieL
+1  A: 

The path that you have in your href "c:/users/jon/desktop/pictures;" is the path from your file system. You will have to make the picture folder accessible from the web (may need to get your hands dirty with Apache config).

An example of config you can add to your apache.conf (Taken from my apache on linux and modified):

  Alias /mypics/ c:/users/jon/desktop/pictures/
  <Location /mypics/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Location>

If you can see a list of files from http://localhost/mypics/ so it means the folder is accessible.

And you can update your path relative to your document root

echo "<a href=\"".$path."/".$file."\">$file</a><br />";

to

echo "<a href=\""/mypics/$file."\">$file</a><br />";

If you dont want to the list of files anymore, change

 Options Indexes FollowSymLinks MultiViews

to

 Options FollowSymLinks MultiViews (not sure about the other options here)
ccheneson
A: 

The files are on the C: drive of the server.

The user cannot access the whole of the C: drive of the server, the server is only serving files that are provided from a specified location - this is the place where the PHP files are stored.

You need to put your image files in the same place, and then point your script towards them there.

If you don't want to/can't move them, then you have to make your webserver access the folder, and you should do this as described by ccheneson if you're using apache.

meepmeep