tags:

views:

177

answers:

1

I'm having some problems using / understanding is_dir. (Yes, I have read the PHP doc).

I have a baseDIR as following:

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\'

The following code is TRUE and therefore outputs the text:

if (is_dir($gallery->baseDIR)) 
  echo 'DIR exists';

Now I need to check if there is a directory called 'f' (yes, just one character). But the following code returns false:

if (is_dir($gallery->baseDIR.'f\\')) 
  echo 'DIR exists';

Why is this not returning true, when the dir exists?

I'm developing on Win XP, but my ISP prod server is Unix.

Update:
Echoing $gallery->baseDIR.'f\' gives me the following output:

I:\Development\wamp\www\mySite\wp-content\uploads\f\

Update 2:
I have to admit that I'm tired after 12h of work and it's way past midnight. Simple STUPID mistake from me. I had forgoten to add he image folder to the base dir....

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\slgallery\'
+1  A: 

It could be an open_basedir restriction. Check the setting by executing phpinfo(), this setting is usually present when safe_mode is enabled.

karim79
In phpinfo(): Safe_mode = Off, open_basedir = no value
Steven
Does it fail on both development and production? Are the read permissions as they are for other directories that work?
karim79
I haven't gotten as far as testing it on a Unix / Linux server yet. I've just started developing. All dirs are created the same way and has the same permissions.
Steven
I would test it on your linux server. I would even try (as unlikely as it is to be the cause) to create another directory with a longer name. I don't see why this should be broken.
karim79
Ok, I fel dumb now. But I have to blame it on the late ours and 12 hours of working. Your suggestion helped me find the problem. I had forgotten to add one extra folder to the baseDIR. Adding this, and it all works! :) Thanks!
Steven
It happens to the best of us, I guess that's why SO was invented. Glad you found your solution :)
karim79