Upload php problem

Asked

Viewed 41 times

0

Can anyone tell me why the file is not being received in the destination folder?

private $id;
private $entrada;
private $saida;
private $status;

public function __construct($bd) {
    $this->bd = $bd;        
}

public function construirObjeto($entrada, $saida, $status) {
    $this->entrada = $entrada;
    $this->saida = $saida;
    $this->status = $status;
}    

public function inserir(){

    $origem = $_FILES["arquivo"]["tmp_name"];


    $entradaa = "emboss/aaindexextract/" . $_FILES["arquivo"]["name"];


    if($entradaa){                 
        $sql = "INSERT INTO caminhoarquivo(entrada, saida, status) VALUES ('$entradaa', 'NULL', 'SOLICITADO')";

        $this->bd->executarSql($sql);
    }else{
        echo "Erro!";
    }

    //salva foto no diretorio
    move_uploaded_file($origem, $entradaa);

}

  • Check the permissions of the destination folder

  • The data is being entered into the database?

  • yes data is being entered only without the $_FILES["file"]["name"] only Emboss/aaindexextract/

  • do a debug then use: print_r($_FILES["file"] or var_dump($_FILES["file"]

  • I have already performed the debug, nothing is coming in $_FILES["file"] .

  • Then see if the html form tag has the attribute: enctype="Multipart/form-data"

  • Thank you so much for the help, I had even forgotten to put the enctype="Multipart/form-data

Show 2 more comments

1 answer

0


Problem solving

missing attribute: enctype, tag form

<form action="#" method="POST" enctype="multipart/form-data">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.