I am trying to upload pictures to my DB and not having much luck.
here is my code for the form which i use to enter a new article, in the form i can get the image and that works ok, it is when I go to insert.php where it doesn't happen. this is my form.
<section id="createPost">
	<form enctype="multipart/form-data" method="post" action="insert.php" name="changer">
			<legend>Create New Post</legend>
			<label for="titleOfPost">Title of Post:</label><br />
			<input type="text" name="titleOfPost" size="82" placeholder="Enter title of post" required /><br />
			<label for="bodyOfPost">Content of Post:</label><br />
			<textarea cols="60" name="postContent" rows="10" placeholder="HTML tags allowed"></textarea><br />
			<label for="authorOfPost">Author:</label><br />
			<input type="text" name="authorOfPost" size="82" placeholder="Author name" required /><br />
			<label for="imageOfPost">Image:</label>
			<input name="MAX_FILE_SIZE" value="102400" type="hidden">
			<input name="imageOfPost" accept="image/jpeg" type="file"><br />

			<input type="submit" name="newPostBtn" value="Create New Post" id="newPostBtn"/>
</section><!--end createPost-->
This is the insert which works but does not upload the image.
PHP Code:
//include DB connect
if (isset(
$_FILES['imageOfPost']) && $_FILES['imageOfPost']['size'] > 0)

/*     temporary file stored on the server */
$tmpName $_FILES['imageOfPost']['tmp_name'];
/*     read the file */
$fp fopen($tmpName'r');
$pic fread($fpfilesize($tmpName));
$pic addslashes($pic);
$stmt $mysqli->prepare("INSERT INTO posts
                                VALUES (?,?,?,?)"
header("Location: index.php");
"No image selected bo hoo!!";
How can I test if my image has been set, as I have got the code from a tutorial which everybody seems to get it to work.
Any help would be great thanks.