$_FILE not defined

Asked

Viewed 35 times

1

I have a problem with the $_FILE global variable. It’s my first time using it, and soon I come across this problem. I set the enctype, all right, but it shows that the variable does not exist...

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
<form method="post" enctype="multipart/form-data">
    <input type="file" name="arquivo">
    <input type="submit" name="upload">
</form>
<br>
<br>
<strong>$_FILE</strong><br>
<br>
<?php var_dump($_FILE); ?>
<br>
<br>
<strong>$_POST</strong><br>
<br>
<?php var_dump($_POST); ?>
</body>
</html>

inserir a descrição da imagem aqui

even after choosing a file, the $_FILE does not work

  • check if it was started first with if (isset($_FILE['arquivo'])) { }

  • I’ve tried that, but I can try again

  • didn’t work..

  • has a <?php var_dump($_FILE); ?> it shouldn’t be like this

  • hello, I’ve tried check mode with isset() and etc, but the error persists, it doesn’t even know the variable $_FILE

  • 1

    Look just went unnoticed is $_FILES at least it was resolved.

Show 1 more comment

1 answer

2


  • If that’s what it is, I swear I’ll drop the PHP of life kkkk...

  • should I delete the post ?

  • No, the method must really be post and also maintains the enctype as multipart/form-data, only then the upload will work.

  • the post I say the publication of doubt itself.

  • 1

    I believe that it can happen to other people, and it can be useful if you google and find this answer. It seems something simple, but I lost count many years ago of the amount of small mistakes that cost me hours to find a solution :)

Browser other questions tagged

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