3
<h1>Upload de Arquivos</h1>
<form name="enviarImagem" action="enviar.php" method="POST" enctype="multipart/form-data">
Arquivo<br> <input type="file" name="img" value=""><br><br>
<input type="submit" value="Enviar" name ="enviar">
<?php
$name = $_FILES["img"]["name"];
$temp = $FILES["img"]["tmp_name"];
/*var_dump($name);
var_dump($temp);*/
$banco = new mysqli("localhost", "root", "", "projeto");
$sql = "INSERT INTO imagem (nome) VALUES ('{$name}')";
$banco->query($sql);
$banco->close();
move_uploaded_file($temp, "./imagens/".$name);
header("Location: upload.php");
?>
Check that the folder is allowed. Also check that the path is correct by giving the realpath("./images/".$name) command; and see if it is correct.
– Rodrigo Bezerra Rodrigues
in one of the
$_FILES
missing a_
– Isac