Forums

PHP upload file usng mkdir() (4 posts)

  1. highway7
    Member
    Posted 3 years ago #

    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 http://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

  2. queenvictoria
    Member
    Posted 2 years ago #

    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);
  3. muradsweiss
    Member
    Posted 2 years ago #

    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

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    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.

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

    http://www.deliciousdays.com/cforms-plugin there's where to get it

    Dunno if you are looking for an easy out?

Topic Closed

This topic has been closed to new replies.

About this Topic