• Hi,

    I am using wordpress to create a site and am trying to implement an upload form where customers can upload their own image to our database. As part of the code I am using the mkdir() function to create an uploads directory. Like this:

    mkdir($dir_name) or die("Could not create directory " . $dir_name);

    However, I am getting the following error:

    Could not create directory https://www.tommy-barker.com/coi/wp-content/themes/change/upload/11042009

    Does anybody have any idea what the problem is? I thought maybe it was something to do with wordpress but I have tried it outside of wordpress and get the same error.

    Thanks

    -John

Viewing 3 replies - 1 through 3 (of 3 total)
  • possible the directory has already been created . before you try to make it test to see if it exists already .

    if ( ! is_dir($dir_name) )
    	mkdir($dir_name) or die("Could not create directory " . $dir_name);

    Hi, i am trying to do the same thing but using AWPCP – I get error – can anyone please help me to fix this error — I am no PHP pro
    Warning: mkdir() [function.mkdir]: No such file or directory in /home/homehost/public_html/ecomena.com/wp-content/plugins/another-wordpress-classifieds-plugin/upload_awpcp.php on line 38

    Warning: mkdir() [function.mkdir]: No such file or directory in /home/homehost/public_html/ecomena.com/wp-content/plugins/another-wordpress-classifieds-plugin/upload_awpcp.php on line 44

    Warning: move_uploaded_file(/home/homehost/public_html/ecomena.com/wp-content/uploads/awpcp//1255102617_3.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/homehost/public_html/ecomena.com/wp-content/plugins/another-wordpress-classifieds-plugin/upload_awpcp.php on line 224

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpYL3iy8’ to ‘/home/homehost/public_html/ecomena.com/wp-content/uploads/awpcp//1255102617_3.jpg’ in /home/homehost/public_html/ecomena.com/wp-content/plugins/another-wordpress-classifieds-plugin/upload_awpcp.php on line 224

    I can’t help with what you are trying to do , per se….

    but the cforms plugin is what I use to have an upload form on my site.

    https://www.rvoodoo.com/uploads/ there it is in action

    https://www.deliciousdays.com/cforms-plugin there’s where to get it

    Dunno if you are looking for an easy out?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP upload file usng mkdir()’ is closed to new replies.