-1

I'm working on an app.

My HTML code:

<form action="invio_segnalazione.php" method="post" enctype="multipart/form-data">
        
        <br><br>&nbsp &nbsp &nbsp &nbsp Inserire immagine:
        <br>&nbsp &nbsp &nbsp &nbsp <input type="file" name="file">
        <br><br><br><br>
        <table class="center"><tr>
            <td><input type="reset" class=button value="Cancella"></td>
            <td align=left><button type="submit" class=button name="submit">Invio</td></tr> 
        </table>
        </form>

The PHP code is:

if(isset($_POST['submit']))
{
    $file = $_FILES['file'];
    print_r($file);
    $nomeImg = $_FILES['file']['name'];
}

The error is:

Notice: Undefined index: file in D:\XAMPP\htdocs\Esercizi_SQL\Sito peppe testa\invio_segnalazione.php

halfer
  • 19,471
  • 17
  • 87
  • 173
  • Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – AymDev Jun 03 '22 at 07:55
  • I cannot explain it. Try `print_r($_FILES);` to see if the file you selected is there at all. Upload a simple `text.txt` file, and not too big, to start with. Also check your PHP error logs. – KIKO Software Jun 03 '22 at 08:40

0 Answers0