html - Problems with uploading files in php

one text

Solution:

<form  enctype="multipart/form-data"  method="post" >
    <input name="userImage" type="file" />  <!--$_FILES['userImage'];-->
    <input type="submit" name="upload" value="submit">
</form>
<?php 
$con = mysqli_connect("localhost","root","","image");
if(isset($_POST['upload'])){
  $file = $_FILES['image']['name'];#$_FILES['userImage'];
  $query = "INSERT INTO upload(image) VALUES ('$file')";
  $res = mysqli_query($con, $query);
  if ( $res){
    move_uploaded_file($_FILES['image']['tmp_name'], $file);#not "$file"
  }
}
?>

Source