I have a HTML form where a user fills out a few details to register for a competition. I want them to be able to upload a photo. The PHP script successfully enters everything into the database except Photo Name and Photo, any ideas why?
HTML:
<form method="post" action="addboat.php">
<p>Add your boat to the 2018 species hunt</p>
<p>Boat Name :- <input type="text" name="boatname" size="42"></p>
<p>Boat Make/Model :- <input type="text" name="boatmake" size="42"></p>
<p>Skipper :- <input type="text" name="skipper"></p>
<p>Photo:- <input type="file" name="file"></p>
<input type="hidden" name="huntyear" value="2018">
<p align="center"><input type="submit" value="Submit" name="B1"></p>
<p align="center"> </p>
</form>
PHP:
$huntyear = $_POST['huntyear'];
$boatname = $_POST['boatname'] ;
$boatmake = $_POST['boatmake'];
$skipper = $_POST['skipper'];
// Image add
$imagename=$_FILES["file"]["name"];
//Get the content of the image and then add slashes to it
$imagetmp=addslashes (file_get_contents($_FILES['file']['tmp_name']));
$query_rsCatch = "INSERT INTO SpeciesHuntBoats (Year, BoatName, BoatMake, Skipper, PhotoName, Photo) VALUES
('$huntyear','$boatname','$boatmake','$skipper','$imagename','$imagetmp')";
$rsCatch = mysql_query($query_rsCatch, $webdb) or die(mysql_error());