Jump to content
Fórum Script Brasil
  • 0

Error Warning: Undefined array key "name" in


Question

 

Alguém pode me ajudar estou tomando esse erro na hora e armazenar a foto

Warning: Undefined array key "name" in C:\xampp\htdocs\test\cadastros\inserir_relatorio.php on line 12
Warning: Undefined array key "name" in C:\xampp\htdocs\test\cadastros\inserir_relatorio.php on line 12
Warning: Undefined array key "name" in C:\xampp\htdocs\test\cadastros\inserir_relatorio.php on line 12

 

<?php
 
include '../menu.php';
$foto = $_FILES['foto'];
 
array_map(function ($foto) {
 
    $= 0;
 
    if($foto !== null) {
 
        preg_match("/\.(png|jpg|jpeg){1}$/i", $foto["name"], $ext);       << A linha onde acontece o erro Warning: Undefined array key "name" >>
 
        include'../conexao/conexao.php';
        if ($ext == true) {
        
        $nome_foto = md5(uniqid(time())) . "." . $ext[1];
        
        $caminho_foto = "../documentos/" . $nome_foto;
        
        move_uploaded_file($foto["tmp_name"], $caminho_foto);
        
        $query = "INSERT INTO foto (nome_foto, id_carro_foto) values ('$nome_foto',1)";
        $query_run = mysqli_query($connection,$query);
        
        }
        
        }
 
    $a++;
}, $foto);
 
 
 
 
?>
Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      149405
    • Total Posts
      645894
×
×
  • Create New...