is_writable() && is_readable() && is_executa

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

is_writable() && is_readable() && is_executa

Post 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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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:
Post Reply