Buona sera a tutti,
al momento ho un sito che utilizza un sistema di caricamento file all'interno di un db che consente di caricarne solo uno alla volta. Vorrei modificarlo consentendo il caricamento anche di più file contemporaneamente. Come posso fare?
Questo è il codice PHP della pagina che effettua il salvataggio nel DB:
Codice PHP:
<?php    session_start();
    require_once(
'mysqlconn.php');
    
mysql_select_db($database$utenti);
    
$id $_SESSION['id'];
    if (
$_SESSION['stat'] != true)
        
header('Location: login.php');
    
$nome htmlspecialchars($_POST['nome']);
    
$tipo htmlspecialchars($_POST['tipo']);
    
$nomefile $_FILES['userfile']['name'];
    
$data addslashes(fread(fopen($_FILES['userfile']['tmp_name'], "rb"),$_FILES['userfile']['size']));
    
$result mysql_query("INSERT INTO file(utente, nome, tipo, nomefile, file, size, type) VALUES ('".$id."', '".$nome."', '".$tipo."', '".$nomefile."', '".$data."', '".$_FILES['userfile']['size']."', '".$_FILES['userfile']['type']."')") or die (mysql_error());
    switch(
$_FILES['userfile']['error']){
        case 
0:
            
header('Location: home.php');
        case 
1:
            
header('Location: caricafile.php?error=1');
        case 
2:
            
header('Location: caricafile.php?error=2');
        case 
3:
            
header('Location: caricafile.php?error=3');
        case 
4:
            
header('Location: caricafile.php?error=4');
        case 
6:
            
header('Location: caricafile.php?error=6');
?>