php does not access the image input file from html to php I am getting error [duplicate]

  html, mysql, php

I have to upload an image into the folder and path into the database.
this is the code below.

<form action="load.php" method="post">
<input type="file" name="image" accept=".jpg,.png">
<input type="submit" name="submit">
</form>


<?php 
$image = "";
if (isset($_POST['submit'])) {
 $image = $_FILES['image']['name'];
}
?>

I am getting an error "Notice: Undefined index: image in C:xampphtdocsload.php on line 4" and "Notice: Trying to access array offset on value of type null in C:xampphtdocsload.php on line 4"

Source: Ask PHP

LEAVE A COMMENT