I am trying to upload the name of the selected file to the database. For this I made a HTML page . The code of HTML page is
<!DOCTYPE html>
<html lang="en">
<head>
<title>Photo Input</title>
</head>
<body>
<form action="input-photo.php" method="POST" enctype="multipart/form-data" >
<h3>Insert a photo</h3>
<input type="file" name="image" id="1" >
<br>
<br>
<input type="submit" name="upload" value="upload image">
</form>
</body>
</html>
The action of this form in HTML is in input-photo.php file . The code of this php file is
<?php
$server = "localhost";
$username ="root";
$password = "";
$conn = mysqli_connect($server,$username,$password,"form");
if(isset($_POST['upload']))
{
$name = $_FILES['image']['name'];
echo $name;
}
?>
But when i run this segment of code it shows two warnings:-
Warning: Undefined array key "image"
Warning: Trying to access array offset on value of type null
The warning is shown for the .php file where $_FILES is used. It says Undefined array key "image"
I dont know how to resolve this.
var_dump($_FILES);file_uploads=Onin php.ini file