I am facing issue with the move_uploaded_file() php function below is my script.
Its saying permission denied . The directory is not writable . But I checked the permissions , its read-write-execute. Not Sure what's the issue , How do I make sure the permission is R-W-X. ?
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
$target = "BharatTest/";
$photoName = basename( $_FILES['image']['name']);
$target = $target . basename( $_FILES['image']['name']) ;
ini_set('display_errors', 1);
echo '<pre>Debug: tmp file:', htmlspecialchars($_FILES['image']['tmp_name']), "</pre>
";
echo '<pre>Debug: target directory: ', htmlspecialchars("BharatTest/"), "</pre>
";
echo '<pre>Debug: real target: ', htmlspecialchars(realpath("BharatTest/")), "</pre>
";
echo '<pre>Debug: source readable: ', is_readable($_FILES['image']['tmp_name']), "
</pre>
";
echo '<pre>Debug: target is_dir: ', is_dir("BharatTest/") ? 'yes':'no', "</pre>
";
echo '<pre>Debug: target writable: ', is_writeable("BharatTest/") ? 'yes':'no', "
</pre>
";
if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
{
echo "YES";
}
else
{
echo "NO";
}
?>