move_uploaded_file can’t catch a file

Asked

Viewed 91 times

2

Hello, the move_uploaded_file can’t get a file.

        echo "  <form  method=\"post\" enctype=\"multipart/form-data\" action=\"testar_formato.php\" id=\"upload-container\" class=\"fileUpload\">
                <span>Upload</span>
                <input id=\"arquivo\" class=\"upload\" type=\"file\" />
                <br>
                <input id=\"enviar\" type=\"submit\" />
            </form>"; 

This file here:

        echo "  <form action=\"testar_formato.php\" id=\"upload-container\" class=\"fileUpload\">
                <span>Upload</span>
                <input id=\"arquivo\" class=\"upload\" type=\"file\" />
                <br>
                <input id=\"enviar\" type=\"submit\" />
            </form>";

Makes that mistake:

And this is line 2:

$arquivo_up = $_FILES['arquivo']['name'];
  • Is missing name="arquivo" in his <input>.

1 answer

1


Add the attribute name to his input:

<input id=\"arquivo\" name=\"arquivo\" class=\"upload\" type=\"file\" />

Browser other questions tagged

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