i want to create a folder on server using php and make it writable so tht i can upload files to it using form...

can someone help me with script on making folder and making it writeable on server.

thanx

You may also need to deal with permission issues. The web server typically runs as a different user (such as "nobody") than the user you use to manually create files/directories via FTP or command line.

If you create a directory with your PHP script, the owner will probably be the web server user and not you. So in addition to reading about the mkdir() function, you might also want to read about chmod() to set permissions accordingly.

http://us2.php.net/manual/en/function.chmod.php

-Dave

thanx ... i did use mkdir ...with tht i m able to make the dir successfully on my harddisk while testing. ut on web server its not doing it ....cant figure out y plz help

here is my code

<?php
  mkdir ("/htdocs/lucky", 0777);
  echo " dir made successfully";

  ?>

plz help

thanx ... i did use mkdir ...with tht i m able to make the dir successfully on my harddisk while testing. ut on web server its not doing it ....cant figure out y plz help

here is my code

<?php
  mkdir ("/htdocs/lucky", 0777);
  echo " dir made successfully";

  ?>

plz help

Well from that path specified, if it were on an online server it would look like if you have a dedicated server or same server configurations as your testing environment. When placing a / at the beginning of the path, it makes the location start from the beginning of the server root and usually there are a few folders it has to go through before getting to your account. I would suggest making a relative path to the script so for example, if the script was in your hompage or the same directory as your homepage then the following would apply:

<?php
  mkdir ("lucky", 0777);
  echo " dir made successfully";
  ?>

its not working i did try that....i use a free server ...it has a folder htdocs within which i have to upload all the files like index or others.

This question has already been answered. Start a new discussion instead.