Problem uploading images into a MySql database

Hey, ive got a problem with PHP and MySql. Im building a website where users can upload an image, ingredients and recipe for a sandwich, which is then added to a database of sandwiches. Users can search and comment on sandwiches as well as add favourites and so on.

Im still at early stages now, user registeration and login is working, along with the main layout of the site. This is one of the first time ive used php, and definately the biggest site project ive worked on on my own.

My problem is with letting users upload an image. From what I can see all my code is correct, and ive set the write permissions on the uploads folder.

Here is the process page you are sent to after clicking submit on the submit sandwich form.



<?
    include ('header.php');
    
$maxFileSize = 5000000;
$message = "";

$image = $_FILES['imgFile']['image'];
$imgFileTmp = $_FILES['imgFile']['tmp_name'];
$imgFileSize = $_FILES['imgFile']['size'];
$imgFileType = $_FILES['imgFile']['type'];
$sandwichname = $_POST['sandwichname'];
$ingredients = $_POST['ingredients'];
$breadtype = $_POST['breadtype'];
$instructions = $_POST['instructions'];


$filePath = "uploads/".$image;

if ($imgFileSize > $maxFileSize) {
    $message = "Sorry, your file exceeds the size limit.";
}

if($message == ""){
    move_uploaded_file($imgFileTmp, $filePath);

    $sql = "INSERT INTO sandwich (sandwichname,ingredients,breadtype,instructions,image) VALUES ('$sandwichname','$ingredients','$breadtype','$instructions','$filePath')";
    if(!mysql_query($sql,$db_connect)){
        die("error");
        header("Location:sandwich.php");
    }
        mysql_close($db_connect);
    }else{ 
        $message .="error!!";
    }
?>


Header.php holds my databse connect information. I cant see what the problem is. Everything posts into the database apart from the image field. which just comes up as “uploads/”. Can anyone see why the image isnt uploading to my “uploads/” directory properly?

Thanks for your help in advance, I know its basic but we all start somewhere :smiley: