Visualizzazione dei risultati da 1 a 2 su 2

Discussione: form non funzionante

  1. #1
    Utente di HTML.it L'avatar di crisal
    Registrato dal
    Oct 2001
    Messaggi
    45

    form non funzionante

    ciao a tutti qualcuno sa dirmi perche' questo form non mi manda la variabile file al file prova.php?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>File sender</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/javascript">
    <!--
    function checkform ( form )
    {
    if (form.file.value == "")
    {
    alert( "Please enter a file." );
    form.file.focus();
    return false ;
    }
    return true ;
    }
    </script>
    </head>

    <body>
    <form name="form1" enctype="multipart/form-data" method="post" action="prova.php" onSubmit="return checkform(this);">
    <table width="500" border="0" align="center">
    <tr>
    <td><div align="center">
    <input name="file" type="file">


    </div></td>
    </tr>
    <tr>
    <td><div align="center"><font size="2" face="Arial, Helvetica, sans-serif">You
    can send one file at the time.

    If you want to send more the one file at the time you can make a zip
    file and send it. </font></div></td>
    </tr>
    <tr>
    <td> <div align="center">
    <input type="submit" name="Submit" value="Send">
    </div></td>
    </tr>
    </table>
    <div align="center"></div>
    </form>
    </body>
    </html>
    ===================================
    file prova.php
    <?
    $file=$_POST['file'];
    if($file)
    echo $file;
    else
    echo "nop!!";
    ?>

  2. #2
    Sei OT ma immagino che il post verrà spostato.

    Per gestire l'upload di file non devi utilizzare $_POST ma la variabile globale $_FILES

    http://www.php.net/manual/it/features.file-upload.php

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.