Page 1 of 1

PHP upload file usng mkdir()

Posted: Sat Apr 11, 2009 3:35 pm
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

Re: PHP upload file usng mkdir()

Posted: Sat Apr 11, 2009 9:08 pm
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.

Re: PHP upload file usng mkdir()

Posted: Sun Apr 12, 2009 3:08 am
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

Re: PHP upload file usng mkdir()

Posted: Sun Apr 12, 2009 7:08 am
by yacahuma
sorry, but I never worked with wordpress, so I have no idea. Try checking on a wordpress forum.