Si quello che mi hai detto lo fatto effetivamente il nome era sempre uguale, ma pero il mio script non funziona ancora, adesso per semplificare ho tolto tutti i controlli:
Codice PHP:
<?php
$numberfile = $_POST['uploadfile'];
$maxFileUpload = "30";
$target_path = "./upload/";
$target_path = $target_path . basename($fileupload_name);
/////////////////////////////////////////////////////////////////////////
$fileupload_temp = $_FILES['fileupload']['tmp_name'];
$fileupload_name = $_FILES['fileupload']['name'];
$fileupload_size = $_FILES['fileupload']['size'];
$fileupload_type = $_FILES['fileupload']['type'];
$fileupload_error = $_FILES['fileupload']['error'];
// Controllo se Submit é impostato
if (isset($_POST['Submit']))
{
if (isset($numberfile) && $numberfile == 1)
{
move_uploaded_file($fileupload_temp, $target_path);
$msg = "<span class=\"TestoLinks\">Il file $fileupload_name é stato caricato con successo.</span>";
$img = "<img src=\"./upload/$fileupload_name\" width=\"120\" height=\"80\">";
}
else
{
$numberfile = $_POST['uploadfile'];
for($i=1;$i<=$numberfile;$i++)
{
move_uploaded_file($fileupload_temp['$i'], $target_path);
$msg = "<span class=\"TestoLinks\">Il file $fileupload_name é stato caricato con successo.</span>";
$img = "<img src=\"./upload/$fileupload_name\" width=\"120\" height=\"80\">";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Seleziona il numero di file che vuoi caricare </p>
<form id="selectNumber" name="selectNumber" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<select name="uploadfile" id="uploadfile">
<?php
for($i=1;$i<=$maxFileUpload;$i++) {
echo "<option value=\"$i\">$i</option>";
}
?>
</select>
<input name="go" type="submit" id="go" value="Go" />
</form>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data" name="fileupload" id="fileupload">
<?php
for($i=1;$i<=$numberfile;$i++) {
echo "$i<input type=\"file\" name=\"fileupload".$i."\" id=\"fileupload".$i."\" />
";
}
?>
<input name="Submit" type="submit" id="Submit" value="Submit" />
</form>
<?php echo $msg."
".$img;?></p>
</body>
</html>
non capisco come farli copiare nella cartella upload!!
Se sapete darmi altre dritte, ve ne sarei grato!
Grazie Michel