PHP upload file usng mkdir()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
highway7
Forum Newbie
Posts: 5
Joined: Sat Apr 11, 2009 3:21 pm

PHP upload file usng mkdir()

Post by highway7 »

Hi,

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

Code: Select all

mkdir($dir_name) or die("Could not create directory " . $dir_name);
However, I am getting the following error:

Code: Select all

Could not create directory http://www.tommy-barker.com/coi/wp-cont ... s/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
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: PHP upload file usng mkdir()

Post by yacahuma »

it usually means that the username that the web server runs as dont have permission to write on that directory. You usually have to set that manually.
highway81
Forum Newbie
Posts: 3
Joined: Fri Jun 06, 2008 8:24 am

Re: PHP upload file usng mkdir()

Post by highway81 »

Hi,

Thanks for your response. How do I go about setting this? I cant change permissions directly on the directory as I then get an internal server error due to wordpress.

Any ideas?

Thanks
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: PHP upload file usng mkdir()

Post by yacahuma »

sorry, but I never worked with wordpress, so I have no idea. Try checking on a wordpress forum.
Post Reply