creating a directory with PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carllucas
    New Member
    • Oct 2006
    • 35

    creating a directory with PHP

    Hi there. I'm trying to create a temporary directory using php.

    I use the mkdir function but it doesn't seem to work. This is my code:


    Code:
    if(!file_exists($dir))
    {
    	$attempt = mkdir($dir, 0775);
    
    	if ($attempt) { echo "sucess"; }
    
    	else { echo "error"; }
    }
    I keep getting "error".

    Any help will be much appriciated.
  • subash
    New Member
    • Sep 2006
    • 32

    #2
    Hi,

    The same code is works fine for me - I think because of the directory permission you may not able to create the folder. So check the parent directory permission.

    If you are not able to create the folder - try exec function.

    Subash :)

    Comment

    • carllucas
      New Member
      • Oct 2006
      • 35

      #3
      Thanks subach. Can you tell me how to check the permission on my parent directory because I tried exec(mkdir($dir , 0775)) doesn't work.

      I think it is a permission thing or a safemode thing with php.

      Comment

      Working...