RE: [PHP] Help is_dir command driving me crazy!
| From: | joakim dot andersson at cybercom dot se | Date: | Thu, 24 Jan 2002 12:56:35 +0000 |
| Subject: | RE: [PHP] Help is_dir command driving me crazy! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81867@lists.php.net to get a copy of this message | ||
Try to add the following line above all code:
clearstatcache();
This clears the status from previous is_dir()'s.
Good luck,
Joakim
> -----Original Message-----
> From: Dean Dunn [mailto:ddunn@lwdd.fsnet.co.uk]
> Sent: Tuesday, January 22, 2002 6:11 PM
> To: php-general@lists.php.net
> Subject: [PHP] Help is_dir command driving me crazy!
>
>
> Can anyone tell me why this script doesn't work properly.
> I've coded it
> several others ways including using is_dir pointing to the full path.
> Nothing works reliably, it works sometimes/sometimes not.
>
> One interesting thing is that my PHP ecommerce app
> (osCommrce) is run and
> then my script is run it always seems to work. This to me
> points to some
> form of initialisation I'm missing.
>
> Any advice would be gratefully received.
>
> Regards,
>
> Dean (a new PHP user)
>
> Code Follows........
>
> <?php
>
> $dir_path = "\Inetpub\wwwroot\catalog\images";
> $dir = "abc";
> $complete_path = "$dir_path\\$dir";
> $dir_exists = "Directory already exists...can not create again<BR>";
> $dir_not_exist = "Directory does not exist...will try and create new
> directory<BR>";
> $dir_create_success = "Directory created<BR>";
> $dir_create_failure = "Could not create directory<BR>";
>
> print ("Checking to see if subdirectory \"<B>$dir_path\\$dir </B>\"
> exists<BR><BR>");
>
> if (is_dir($complete_path) == true)
> {
> print $dir_exists;
> }
>
> else
> {
> print $dir_not_exist;
> chdir ($dir_path);
> if (mkdir ("abc",0700) == true) {
> print $dir_create_success; }
> else { print $dir_create_failure; }
> }
> ?>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>