In my site, I want to create new files or folders dynamically. I need to check if I have the permission to create new files and folders. How can i do this?
I also want to check if it is allowed PHP code execution is allowed in the client’s server. Is this possible?
you can use: is_writable
eg:
if(is_writable('/path/to/your/dir/'))
{
}
from PHP Manual:
is_writable
Returns TRUE if the filename exists and is writable. The filename argument may be a directory name allowing you to check if a directory 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With