I (and my fellow committe members) have full FTP-access to our website (hosted by a commercial provider). However, if we try to upload a file using the following procedure:
we get the following error messages:
We obviously need more permission - but how?
Code:
$targetDir="/XXX/customers/XXXXXX/XXXXXXXXX.nl/phptest/pictures/activiteiten/";
if (!empty($_FILES["image"]["tmp_name"]))
{
$targetFile = $targetDir . basename($_FILES["image"]["name"]);
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$check = getimagesize($_FILES["image"]["tmp_name"]);
if($check !== false)
{
$uploadOk = 1;
}
else
{
$uploadOk = 0; //not an image
}
if ($_FILES["image"]["size"] > 500000)
{
$uploadOk = 0; //image too large
}
if ($uploadOk == 0)
{
echo "Sorry, image is too big!";
}
else
{
// if everything is ok, try to upload file
if (move_uploaded_file($_FILES["image"]["tmp_name"], $targetFile)) //this is line 373
{
echo "Image ". htmlspecialchars(basename( $_FILES["image"]["name"])). " has been uploaded.";
}
else
{
echo "Sorry, uploading failed!";
}
}
}
we get the following error messages:
Code:
Warning: move_uploaded_file(/XXX/customers/XXXXXX/XXXXXXXXX.nl/phptest/pictures/activiteiten/aanmelden.jpg): failed to open stream: Permission denied in /XXX/CUSTOMERS/XXXXXX/XXXXXXXXX.nl/phptest/admin/activiteit.php on line 373
Warning: move_uploaded_file(): Unable to move '/tmp/php8aLh31' to '/XXX/customers/XXXXXX/XXXXXXXXX.nl/phptest/pictures/activiteiten/aanmelden.jpg' in /XXX/customers/XXXXXX/XXXXXXXXX.nl/phptest/admin/activiteit.php on line 373
We obviously need more permission - but how?