vendredi 12 mars 2021

PHP Laravel 5.2 - Folder not found code exception

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";
                }
            }
        }
    }

Directory

error



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3rFdBhI
via IFTTT

Aucun commentaire:

Enregistrer un commentaire