Buongiorno ragazzi,
Vorrei inserire nel mio sito la possibilità di fare un upload per una gallery.(ovviamente multiplo)
Son riuscito con l'upload singolo ma mi serve un upload multiplo
dato questo codice :
codice HTML:
<div style="margin:1em auto; width:333px; text-align:center;"> <form action="<?php echo $_SERVER['main.php?page=utente=']; ?>" method="POST" enctype="multipart/form-data" >   Upload File: <input type="file" name="fileup" /><br/>  <input type="submit" name='submit' value="Upload" />  <input type="hidden"              value="<?php echo query_filter('get',$_REQUEST['pg']); ?>"              name="pg" />  </form>
</div>
Codice PHP:
<?php$nome=($_SESSION['login']);
$uploadpath 'pages/gallery/';      // directory to store the uploaded files
$max_size 8000;          // maximum file size, in KiloBytes
$alwidth 1500;            // maximum allowed width, in pixels
$alheight 1500;           // maximum allowed height, in pixels
$allowtype = array('bmp''gif''jpg''jpe''png');        // allowed extensions
if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) { 
 
$uploadpath $uploadpath."galleria_".$nome;       // gets the file name 
 
$sepext explode('.'strtolower($_FILES['fileup']['name'])); 
 
$type end($sepext);       // gets extension  
list($width$height) = getimagesize
($_FILES['fileup']['tmp_name']);     // gets image width and height 
 
$err '';         // to store the errors
  // Checks if the file has allowed type, size, width and height (for images)  
if(!in_array($type$allowtype)) $err .= 'Questo file: <b>'$_FILES['fileup']['name']. '</b> non ha un estensione conforme al sistema .';  if($_FILES['fileup']['size'] > $max_size*8000$err .= '<br/>Immagine troppo pesante: '$max_size' KB.';  if(isset($width) && isset($height) && ($width >= $alwidth || $height >= $alheight)) $err .= '<br/>La grandezza massima per immagine è di: '$alwidth' x '$alheight;
  
// If no errors, upload the image, else, output the errors 
 
if($err == '') {       if(move_uploaded_file($_FILES['fileup']['tmp_name'], $uploadpath)) {                   echo 'Upload  effetuato con successo!';      if(isset($width) && isset($height))                   $a=('http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['REQUEST_URI']), '\\/').'/'.$uploadpath.'');    milldigital_query("UPDATE utente SET url_img='".$a."' WHERE utente = '".$_SESSION['login']."'");
            

             }    else echo 
'<b>Unable to upload the file.</b>';  }  else echo $err;}?>
Come effettuereste l'upload multiplo ?