Page 1 of 1

is_writable() && is_readable() && is_executa

Posted: Sun Aug 21, 2005 9:51 pm
by neophyte
I am trying to test a directory to make sure a directory 0777 so I can write to it and execute it. I'm using a statement like:

Code: Select all

if (is_writable() && is_readable() && is_executable())
Create and place jpg's and what not in it. I was reading the manual and it said this about is_writable:
Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account.
So is 'is_writable' not to be trusted? If it is will it give me accurate information on a windows system? If so what should I use? How do you test a folder/file for this?


Thanks

Posted: Sun Aug 21, 2005 9:54 pm
by hawleyjr
This is kinda a guess; but what if you used fopen() and did a catch statement?
If the open fails, the function returns FALSE and an error of level E_WARNING is generated.

Posted: Sun Aug 21, 2005 10:55 pm
by neophyte
I guess that's one way -- touch(), fopen() -- if they do that I'd know for sure if it was accessible. I was hoping there might be a ligther weight way of doing it. :roll: