RE: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website
| From: | Jim Moseby | Date: | Wed, 04 Jan 2006 19:48:55 +0000 |
| Subject: | RE: [PHP] Newbie question: need to transfer directory contents fr om my local machine to my website | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-228167@lists.php.net to get a copy of this message | ||
> >
> > You will not be able to do what you propose with a purely
> PHP solution. PHP
> > is a server-side technology. That means all the processing
> is done at the
> > server, then output to your browser. PHP, to my knowledge,
> has no way to
> > inspect your computer's folders. You would need to look to
> a client-side
>
> er??? stick the following in a file (localfiles.php):
>
> <?php
>
> function readDirWin($dir) {
> $d = dir($dir);
> while (false !== ($entry = $d->read())) {
> if($entry!="." && $entry!="..") {
> echo ($entry = $dir."\\".$entry), "\n";
> if(is_dir($entry)) {
> readDirWin($entry);
> }
> }
> }
> $d->close();
> }
> var_dump( readDirWin("C:") );
>
> ?>
>
> and call it like so:
> C:\path\to\your\CLI\php.exe C:\path\to\your\localfiles.php
Perhaps I misunderstand what the OP wanted. I thought he was running a
webserver somewhere, and that he wanted his remote webserver to be able to
grab a file listing on his local machine by just visiting a webpage there.
Of course PHP can query the local filesystem. I thought he wanted it to
query a remote filesystem.
JM