Запись изображения в Mysql
Вопрос заключается в следующем, как записать изображение из формы html в mysql форма html
<form method="POST" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputEmail4">Фамилия</label>
<input type="text" name="famil" class="form-control" id="inputEmail4">
</div>
<div class="form-group col-md-4">
<label for="inputPassword4">Имя</label>
<input type="text" name="name" class="form-control" id="inputPassword4">
</div>
<div class="form-group col-md-4">
<label for="inputPassword4">Отчество</label>
<input type="text" name="otech" class="form-control" id="inputPassword4">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputAddress">Временный логин</label>
<input type="text" name="login" class="form-control" id="inputAddress" placeholder="loogin">
</div>
<div class="form-group col-md-6">
<label for="inputAddress">Временный пароль</label>
<input type="password" name="password" class="form-control" id="inputAddress" placeholder="password">
</div>
</div>
<div class="form-group">
<label for="inputAddress2">Address 2</label>
<input type="text" name="address" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor">
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputCity">Паспорт</label>
<input type="text" name="passport" class="form-control" id="inputCity">
</div>
<div class="form-group col-md-4">
<label for="inputCity">Город</label>
<input type="text" name="city" class="form-control" id="inputCity">
</div>
<div class="custom-file col-md-4" style="margin-top: 2em;">
<label class="custom-file-label" for="customFile"></label>
<input type="file" name="fils" class="custom-file-input" id="customFile">
</div>
</div>
<button type="submit" name="submit" class="btn btn-primary">Зарегистрировать</button>
</form>
Скрипт записи в базу. данные пишутся все кроме изображения, не могу понять что сделано не так
<?php
$link=mysqli_connect("localhost", "root", "", "com");
if(isset($_POST['submit']))
{
$usname = $_POST['name'];
$famil = $_POST['famil'];
$fath = $_POST['otech'];
$pasport = $_POST['passport'];
$login = $_POST['login'];
$password = $_POST['password'];
$adres = $_POST['address'];
$city = $_POST['city'];
mysqli_query($link,"INSERT INTO register_partner SET usname='".$usname."', famil='".$famil."', fath='".$fath."', pasport='".$pasport."', ulogin='".$login."', upassword='".$password."', adres='".$adres."', city='".$city."'");
$imagename=$_FILES["fils"]["name"];
$imagetmp=addslashes(file_get_contents($_FILES['fils']['tmp_name']));
$insert_image="INSERT INTO register_partner SET fils VALUES('$imagetmp','$imagename')";
mysqli_query($link, $insert_image);
}
?>