Good afternoon, I'm trying to do the file upload function via PHP using the code below:
if(isset($_FILES['arquivo']))
{
$diretorio = "D:/wamp64/www/revi/arquivos/postagens/".$postagem;
if(!is_dir($diretorio))
{
mkdir("D:/wamp64/www/revi/arquivos/postagens/".$postagem , 0777);
$arquivo = $_FILES['arquivo'];
for ($k = 0; $k < count($arquivo['name']); $k++)
{
$destino = $diretorio."/".$arquivo['name'][$k];
if (move_uploaded_file($arquivo['tmp_name'][$k], $diretorio))
{
echo "MOVEUUUUUU<br>";
}
else
{
echo "não moveu! <br>";
echo $_FILES["arquivo"]["error"];
}
}
}
And my form is like this
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="arquivos[]" multiple/>
<button type="submit">Upload</button>
</form>
But it just does not work. The echo of $FILES["arquivo"]["error"]
returns 0 as if it had successfully uploaded, but I go in the folder and there is nothing there. What is missing to work?
Thank you!