move_uploaded_file saves in database, but does not save image to folder! Someone help

2
<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");

?>
    
asked by anonymous 16.11.2018 / 03:02

0 answers