I can not upload image. And i am using lampp server in ubuntu. It shows some errors that i can not figure out..
if (isset($_POST["submit"]))
{
$fileType = $_FILES["file"]["type"];
if (($fileType == "image/gif") ||
($fileType == "image/jpeg") ||
($fileType == "image/jpg") ||
($fileType == "image/png")) {
//Check if file exists
if (file_exists("Images/Coffee/" . $_FILES["file"]["name"])) {
echo "File already exists";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "Images/Coffee/" . $_FILES["file"]["name"]);
echo "Uploaded in " . "Images/Coffee/" . $_FILES["file"]["name"];
}
} }
And my errors are
Warning: move_uploaded_file(Images/Coffee/costa.png): failed to open stream: Permission denied in /opt/lampp/htdocs/newphp/uplaodimage.php on line 23
Warning: move_uploaded_file(): Unable to move '/opt/lampp/temp/phpE2uIod' to 'Images/Coffee/costa.png' in /opt/lampp/htdocs/newphp/uplaodimage.php on line 23 Uploaded in Images/Coffee/costa.png