Forum Moderators: coopster

Message Too Old, No Replies

readdir from local hard disk

Trying to access local directory

         

barry95258

12:49 pm on Sep 14, 2004 (gmt 0)

10+ Year Member



I have written a script to upload images from a clients hard disk to our server, which works fine.

I would like to display all images on a direcvtory so that I can upload an image based upon the thumbnail display. I am having trouble trying to ger a dir listing the clients c: drive?

$fd = opendir("$ImageDir");

while($entry = readdir($fd)) {
$dis = substr($entry,0,2);
if ($dis!= "10"){
if(eregi(".(jpg¦gif¦png)$",$entry)) {


echo "<a href=$PHP_SELF?pic=/images/$entry>/images/$entry</a>";
echo "<a href=\"/images/$entry\">";
echo "<img src=\"/images/$entry\" align=middle
border=0 height=80 width=100>";
echo " $entry</img></a><br>\n";
}
Where $ImageDIr could be c:/apache/htdocs/images

Can anybody please help?

dcrombie

1:50 pm on Sep 14, 2004 (gmt 0)



You want to display thumbnails of images located in a directory on the client-side using PHP which is server-side?
If so, you have a problem ;)

[edited by: dcrombie at 2:01 pm (utc) on Sep. 14, 2004]

coopster

1:58 pm on Sep 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, barry95258.

dcrombie is correct, PHP is a server-side solution and unable to give you a directory listing from the client hard disk drive as you are requesting. Did you mean to word your question differently?

barry95258

6:12 am on Sep 15, 2004 (gmt 0)

10+ Year Member



Thanks for the feedback.
I assumed that it was possible based upon the fact that my "<input type=file.." went to the client side pc.

Now I wont spend any more time trying it.
I suppose if there is a real need I can get clients to install triad apache and then give them a localhost php script to do this!

Thanks again!

coopster

3:24 pm on Sep 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Your <input type="file"...> does indeed prompt the user with a browse dialog window. Depending on the client being used, they could simply change their "View" to thumbnails and see them at that time. Maybe your solution is as simple as an HTML help window that explains to them how to do so?