I'm making a simple upload system, for some reason it keeps giving me the error I programmed if the folder doesn't exist, even if it exists. I've tried to put the URL of everything that is, the directory of the folder is below.
public function anexar()
{
$diretorio = "imagens/";
if (!is_dir($diretorio)) {
echo "Folder $diretorio not found";
} else {
$arquivo = isset($_FILES['arquivo']) ? $_FILES['arquivo'] : FALSE;
for ($controle = 0; $controle < count($arquivo['name']); $controle++) {
$destino = $diretorio . "/" . $arquivo['name'][$controle];
if (move_uploaded_file($arquivo['tmp_name'][$controle], $destino)) {
echo "Upload realizado com sucesso<br>";
} else {
echo "Erro ao realizar upload";
}
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire