0
I’ve tried every way move_uploaded_file() move the desired file.
I set up a simple image upload form, but it doesn’t move at all.
POST:
$foto = $_FILES["txtFoto"];
// Caminho de onde ficará a imagem
$caminho_imagem = "images/";
// Faz o upload da imagem para seu respectivo caminho
if (move_uploaded_file($foto['name'], $caminho_imagem)) {
$uploaddir = 'images/'.$foto['name'];
if(isset($_GET['d'])){
$id = $_GET['d'];
produtos::altera($id,$nome,$descricao,$uploaddir);
$dados = produtos::carrega($id);
}else{
produtos::cadastra($nome,$descricao,$uploaddir);
}
?>
<div class="alert alert-success" id="respyes">Produto alterado/cadastrado com sucesso!</div>
<?php
} else {
echo "nome do arquivo '". $foto['name'] . "'.";
}
This is a part of my code and I’ve looked at folder permission, syntax and all the rest, but it doesn’t work :(
The first thing that needs to be noticed is that the use of move_uploaded_file is wrong, the way the colleague @deoliveiralucas posted is correct. According to which image folder is created?(remembering that they will be in the same script folder) it has the correct permissions?
– Rodrigo Jarouche