Hello, move_uploaded_file is not working and I would like to know why
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upload</title>
</head>
<body>
<form method="post" action="pegar.php" name="form">
<input type="file" name="arquivo" value="Escolher">
<input type="submit" name="enviar" value="Enviar" height="50" width="10">
</form>
</body>
</html>
paste.php
$foto = $_FILES['arquivo']['name'];
$foto = str_replace(" ", "_", $foto);
$foto = str_replace("á", "a", $foto);
$foto = str_replace("à", "a", $foto);
$foto = str_replace("â", "a", $foto);
$foto = str_replace("ã", "a", $foto);
$foto = str_replace("é", "e", $foto);
$foto = str_replace("è", "e", $foto);
$foto = str_replace("ê", "e", $foto);
$foto = str_replace("í", "i", $foto);
$foto = str_replace("ì", "i", $foto);
$foto = str_replace("î", "i", $foto);
$foto = str_replace("ó", "o", $foto);
$foto = str_replace("ò", "o", $foto);
$foto = str_replace("õ", "o", $foto);
$foto = str_replace("ô", "o", $foto);
$foto = str_replace("ç", "c", $foto);
$foto = str_replace("û", "u", $foto);
$foto = str_replace("ù", "u", $foto);
$foto = str_replace("ú", "u", $foto);
$foto = strtolower($foto);
if(file_exists("fotos/$foto"))
{
$a = 1;
while(file_exists("fotos/[$a]$foto"))
{
$a++;
}
$foto = "[".$a."]$foto";
}
if(!move_uploaded_file($_FILES['arquivo']['tmp_name'], "fotos/".$foto))
{
echo "<meta http-equiv='refresh' content='0; url=index.php'>
<script type='text/javascript'>alert('Erro no upload do arquivo!')</script>";
}