torno con la richiesta su UPLOAD MULTIPLI
il mio file
Codice PHP:
<form action="itinerari_step3.php" name="itinerari" method="POST" encoding="multipart/form-data">
<table>
<tr><td width="200px" align="right">Cartella</td><td><?php print $nomefile ?>
</td></tr>
<?php
$tot_img = $_POST['tot_img'];
echo "<tr><td width=\"200px\" align=\"right\"><td><input type=\"hidden\" name=\"tot\" value=\"$tot_img\"</td></tr>";
$x=1;
while($x<=$tot_img){
echo "<tr><td width=\"200px\" align=\"right\">Foto $x</td><td><input type=\"file\" name=\"foto[]\" /></td></tr>";
$x++;
}
?>
<tr><td width="200px" align="right"><td><input type="hidden" name="dir" value="<?php print $nomefile ?>"</td></tr>
<tr><td width="200px" align="right"><td><input type="submit" name="submit" value="Invia"</td></tr>
</table>
</form>
Codice PHP:
$dir = $_POST['dir'];
$tot_img = $_POST['tot'];
foreach ($_FILES['foto'] as $key => $value) {
if(!is_uploaded_file($_FILES['foto']['tmp_name'][$key])){
print "
nessun file è stato trasferito</p>";
print error_reporting();
@unlink($_FILES['foto']['tmp_name'][$key]);
} else {
$nome =$_FILES['foto']['name'][$key];
// copia i file nella cartella di destinazione e cancella i temp
copy($_FILES['foto']['tmp_name'][$key],"....mio percorso....");
@unlink ($_FILES['foto']['tmp_name'][$key]);
print "
File aggiunto con successo.</p>";
}
}
Perchè mi da errore di Udentifiet index: foto ?????