RE: [PHP-WIN] problem to open dir
| From: | Armando | Date: | Tue, 30 Nov 2004 05:58:19 +0000 |
| Subject: | RE: [PHP-WIN] problem to open dir | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-25072@lists.php.net to get a copy of this message | ||
Try changing your $dir variable to:
$dir="C:\\Documents and Settings\\pravin\\Desktop\\abcd2";
Failing that, try using the Documents and Settings shortname:
$dir="C:\Docume~1\pravin\Desktop\abcd2";
Or:
$dir="C:\\Docume~1\\pravin\\Desktop\\abcd2";
If none of these work, perhaps also try them and replace the double
quotes that enclose the string to single quotes.
I ran into a lot of issues myself when trying to access the windows
filesystem through PHP when using just single backslashes in my path
variables because, as Mike noted, the \ is typically used to escape
characters. In that case when PHP parses your $dir variable, it could be
stripping out the \ thinking they are escaping the next characters. As
soon as I used the double backslashes in my $dir variables on my own
pages, everything worked fine. Mind you, I then got annoyed with some
other Windows related issues so blew away my development box and put
Linux on it instead :-) But I digress...
Cheers.
Armando
-----Original Message-----
From: Mike [mailto:php@crazyted.com]
Sent: November 29, 2004 11:06 PM
To: 'Pravin-Kumar'; php-windows@lists.php.net
Subject: RE: [PHP-WIN] problem to open dir
When you set the $dir variable, try doing so with single quotes - the \
character is used to escape things and might be causing some problems.
If that makes no sense, it's because I'm falling asleep.
Good luck.
-M
> -----Original Message-----
> From: Pravin-Kumar [mailto:pravin@ncb.ernet.in]
> Sent: Tuesday, November 30, 2004 12:37 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] problem to open dir
>
> hi all
> i am getting some unexpected error while try to read a local dir.. it
> is working on the pc where apache is running ..but same code not
> working while trying from other pcs in lan.. here is code..
> $dir="C:\Documents and Settings\pravin\Desktop\abcd2"; if
> (is_dir($dir)) {
> if ($dh = opendir($dir)) {
> while (($file = readdir($dh)) !== false) {
> echo "filename: $file : filetype: " . filetype($dir
> . $file) ."\n";
> }
> closedir($dh);
> }
> }
>
> $dir = dir($source);
>
>
> giving error:
> Warning: dir(C:\Documents and Settings\pravin\Desktop\cdac2):
> failed to open dir: Invalid argument in
> G:\Vyapar\AdvMgmt\addadvt3.php on line
> 69
>
> Fatal error: Call to a member function on a non-object in
> G:\Vyapar\AdvMgmt\addadvt3.php on line 70
>
>
>
>
> ---------
> Experience is what you get when you didn't get what you wanted.
> ---------
> Regards
> Pravin Kumar
> Technical Associate, CDAC, 68, E-City, Bangalore, 560100. Registered
> Linux user #365056; Ph. +91 80 28523300 Extn:2103
> http://geocities.com/pravin_suman/
> http://pravindeo.blogspot.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php