I\'m getting the following error when trying to call mkdir() on a server...
Warning: mkdir() [function.mkdir]: Permission denied in /home/server/p
Make sure the parent folder is writable to the process that the web server runs as.
Edit: Oops, premature reply. Does your host give you a GUI file browser thingy?
is_writable()
is probably the function you're looking for.
http://cz.php.net/manual/en/function.is-writable.php says:
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.
Also, the directly next line is relevant here:
Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody').
In other words, check if your directory is writable by the user id of the web server - this may be a different user id than yours! Set the appropriate permissions - e.g. set the usergroup of the folder to that of the server's user, and grant read, write, and execute to group. (chgrp somegroup uploads; chmod g+r uploads; chmod g+w uploads; chmod g+x uploads
)