I trying to upload a photo to my server using PHP but the script always goes to the else statement and I can not work out why.
if (isset($_POST['submit'])) {
$image=($_FILES['image']['name']);
$target = "../../portfolio/photos";
$target = $target . basename( $_FILES['image']['name']);
if(move_uploaded_file($_FILES['image']['name'], $target))
{
$sql_addProduct = "INSERT INTO photos (img_url) VALUES '$image'";
$queryresult_add = mysql_query($sql_addProduct);
echo "The file ". basename( $_FILES['image']['name']). " has been uploaded succesfully";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}}
Can anyone shed any light on this issue?
$_FILESfirst?