upload img to image folder
Warning: move_uploaded_file(../images/photos/melb03.jpg): failed to open stream: Permission denied in /home/virtual/site341/fst/var/www/html/mattlauder.com/admin/upload.php on line 29
Warning: move_uploaded_file(): Unable to move '/tmp/phpyNa6ss' to '../images/photos/melb03.jpg' in /home/virtual/site341/fst/var/www/html/mattlauder.com/admin/upload.php on line 29
This is my error i get when i upload an image on media temple server, but on localhost i get no error.
my code
PHP:<?
//initilize PHP
if($_POST['submit']) //If submit is hit
{
include ('connect.php');
//convert all the posts to variables:
$date = $_POST['date'];
$title = $_POST['title'];
$location = $_POST['location'];
$code = $_POST['code'];
$category = $_POST['category'];
$uploaddir = '../images/photos/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$uploadfilename = basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<span class='content'>Added successfully.</span><br>";
} else {
echo "<span class='content'>Sorry not uploaded\n</span>";
}
}
$result=MYSQL_QUERY("INSERT INTO photos (id,date,title,image,location,code,category)".
"VALUES ('NULL', '$date', '$title', '$uploadfilename', '$location', '$code', '$category')");
?>
