I am relatively recent to PHP and I am attempting to write my very own wordpress plugin. Upon wordpress plugin activation it'll run the next function:

function kb_create_uploadfolder () {
     global $wpdp;

     $upload_dir = wp_upload_dir();
     $upload_dir = $upload_dir['basedir'] . "/plugin_uploads";
     $upload_dircheck = wp_mkdir_p($upload_dir);    

I did not bother to check on if the directory already is available before creating it since i have figured it will not overwrite anything or remove the contents whether it does. Correct me if I am wrong.

The truth is however, I must see if the development of your directory was succesful or otherwise however i can't learn how to understand this information.

Use [cde]:


Also, if(is_dir($upload_dircheck)) { echo "It is a dir"; } else { echo "Sorry, non-existent or not a dir"; } does not remove or overwrite existing contents, it simply produces a directory whether it does not exist.

Try [cde].

If you are using PHP 4 or more recent you'll be able to make use of the [cde] function.