ecco il codic che ho sviluppato in 2 minuti dovrebbe funzionare nn ho testato
Codice PHP:
<?php

       
include("config.php");

       include(
'connessione.php');

        
$num_files 4// numero di input che genera per caricare le img
       //if the for has submittedd
       
if (isset($_POST['upForm'])){
for (
$i 1$i <= $num_files$i++) {
       
$file_type $_FILES['imgfile'.$i]['type'];
       
$file_name $_FILES['imgfile'.$i]['name'];
       
$file_size $_FILES['imgfile'.$i]['size'];
       
$file_tmp $_FILES['imgfile'.$i]['tmp_name'];
       
//$descrizione = $_POST['descrizione'];

       //check if you have selected a file.
       
if(!is_uploaded_file($file_tmp)){
          
       
header("Location: upload.php"); /* Redirect browser */
       /* qui invece dell header e dell'exit metti il codice sql che inserisce nel db tutte le info e percorso all'img di default di cui te parlavi */
          
       
exit(); //exit the script and don't do anything else.
       
}

       
//check file extension
       
$ext strrchr($file_name,'.');
       
$ext strtolower($ext);
       if ((
$extlimit == "yes") && (!in_array($ext,$limitedext))) {
          echo 
"Wrong file extension.  
--<a href=\"
$_SERVER[PHP_SELF]\">back</a>";
          exit();
       }
       
//get the file extension.
       
$getExt explode ('.'$file_name);
       
$file_ext $getExt[count($getExt)-1];

       
//create a random file name
       
$rand_name md5(time());
       
$rand_namerand(0,999999999);
       
//get the new width variable.
       
$ThumbWidth $img_thumb_width;

       
//keep image type
       
if($file_size){
          if(
$file_type == "image/pjpeg" || $file_type == "image/jpeg"){
               
$new_img imagecreatefromjpeg($file_tmp);
           }elseif(
$file_type == "image/x-png" || $file_type == "image/png"){
               
$new_img imagecreatefrompng($file_tmp);
           }elseif(
$file_type == "image/gif"){
               
$new_img imagecreatefromgif($file_tmp);
           }
           
//list width and height and keep height ratio.
           
list($width$height) = getimagesize($file_tmp);
           
$imgratio=$width/$height;
           if (
$imgratio>1){
              
$newwidth $ThumbWidth;
              
$newheight $ThumbWidth/$imgratio;
           }else{
                 
$newheight $ThumbWidth;
                 
$newwidth $ThumbWidth*$imgratio;
           }
           
//function for resize image.
           
if (function_exists(imagecreatetruecolor)){
           
$resized_img imagecreatetruecolor($newwidth,$newheight);
           }else{
                 die(
"Error: Please make sure you have GD library ver 2+");
           }
           
imagecopyresized($resized_img$new_img0000$newwidth$newheight$width$height);
           
//save image
           
ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext");
           
ImageDestroy ($resized_img);
           
ImageDestroy ($new_img);
           
//print message
           //echo "
Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>";
        }

        
//upload the big image
        
move_uploaded_file ($file_tmp"$path_big/$rand_name.$file_ext");

        
//echo "
Image Big: <a href=\"$path_big/$rand_name.$file_ext\">$path_big/$rand_name.$file_ext</a>";

        
//echo "

--<a href=\"$_SERVER[PHP_SELF]\">back</a>";

        
//echo "$rand_name.$file_ext";

        
$query "INSERT INTO `immagini` (`big`,`thumbs`, `rand_name`) VALUES ('$path_big/$rand_name.$file_ext', '$path_thumbs/$rand_name.$file_ext', '$rand_name')";

        
/* //test for insert db ok
        echo "$path_big/$rand_name.$file_ext";
        echo "
";
        echo "$path_thumbs/$rand_name.$file_ext";
        echo "
";
        echo "$descrizione";
        echo "
";

        */

        
$result mysql_query($query) or die("Query failed: ".mysql_error());

        if(
$result) {
          echo 
"<div class='err'>

L'immagine "
.$file_name." è stata inserita correttamente


</div>"
;
              echo 
"<meta http-equiv=refresh content=2;url=upload.php>";
          } else {
                 echo 
"<div class='err'>
Errore inserimento immagine.</div>"
;
                 }

}
// chiusura ciclo for
      
}else{ //if the form hasn't been submitted.

      //print the form
      
echo "

        <form method=\"post\" name=\"upForm\" enctype=\"multipart/form-data\" action=\"
$_SERVER[PHP_SELF]\">
        

Pictures:

"
;

for (
$i 1$i <= $num_files$i++) {
echo 
"</td><td><input type=\"file\" name=\"imgfile".$i."\" />
"
;
}
echo 
"


        <input type=\"Submit\" name=\"upForm\" value=\"Upload\" class='submit'>
        </p>
        </form>"
;
      }
      
?>