NYCPHP Meetup

NYPHP.org

[PHP] mkdir() failed: Permission denied

Phil Powell soazine at erols.com
Sat Sep 28 16:11:40 EDT 2002


That's not possible!  /users/ppowell/web/my has permissions set to 0755, I
have full write permissions onto that folder, but I can't create subfolder
/users/ppowell/web/my/images - I don't get it!

Phil

PS New Code
<?
  $willChangeLayout = 1; $isEmptyLayoutValues = 1;

  if (!preg_match ("/\\bdyndns\\b/i", $HTTP_HOST)) {
   $path = "/users/ppowell/web";
  } else {
   $path = "c:/program files/apache group/apache/htdocs/live_site_files";
  }
  $path .= "/my/images/";

  foreach ($_POST as $key => $val) {
   if (strcmp($key, "isDefaultLayout") == 0) $willChangeLayout = 0;
   if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
   ${"$key"} = $val;
  }

  // SERVER-SIDE VALIDATION
  if ($willChangeLayout && $isEmptyLayoutValues)
   header("Location: " . $refURL . "?errorMsg=" . urlencode("Please fill out
all required fields"));

  // FILE UPLOAD HANDLING


  echo ("is directory? " . is_dir("/users/ppowell/web/my/images"));

  if (!is_dir($path)) mkdir($path, 0755);

  //if (is_uploaded_file($_FILES['myImage']['tmp_name']))
  // move_uploaded_file($_FILES['myImage']['tmp_name'], $path .
$_FILES['myImage']['name']);


?>

----- Original Message -----
From: "Sascha Braun" <saschabraun at gmx.de>
To: "Phil Powell" <soazine at erols.com>
Sent: Saturday, September 28, 2002 3:53 PM
Subject: Re: [PHP] mkdir() failed: Permission denied


> You have to be the owenr too and maybe set the permission to 755.
>
>
> > Ok, I am stuck.  I am trying to create a folder in the same directory as
> > process.php and then use
move_uploaded_file($FILES['myImage]['tmp_name'])
> > and it constantly fails:
> >
> > mkdir() failed (Permission denied)
> >
> > Here is my code:
> >
> > <?
> >   $willChangeLayout = 1; $isEmptyLayoutValues = 1;
> >
> >   foreach ($_POST as $key => $val) {
> >    if (strcmp($key, "isDefaultLayout") == 0) $willChangeLayout = 0;
> >    if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
> >    ${"$key"} = $val;
> >   }
> >
> >   // SERVER-SIDE VALIDATION
> >   if ($willChangeLayout && $isEmptyLayoutValues)
> >    header("Location: " . $refURL . "?errorMsg=" . urlencode("Please fill
> out
> > all required fields"));
> >
> >   // FILE UPLOAD HANDLING
> >
> >   $attempt = mkdir("/users/ppowell/web/my/images", 0655);
> >
> >   if (is_uploaded_file($_FILES['myImage']['tmp_name']))
> >    move_uploaded_file($_FILES['myImage']['tmp_name'],
> > "/users/ppowell/web/my/images/" . $_FILES['myImage']['name']);
> >
> >
> > ?>
> >
> > Please someone tell me what I'm doing wrong :(
> >
> > Thanx
> > Phil
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>




More information about the talk mailing list