Ciao a tutti,
ho questo problema: dopo aver studiato, ho aggiornato e corretto questo script che effettua l'upload di fotografie, inserendo i dati nel mio db.
Lo provo in localhost e funziona perfettamente anche con le foto di grandi dimensioni, sono riuscito anche ad inserire le istruzioni che effettuano il resize e riducono la qualità per avere file più piccoli, ma ieri l'amara sorpresa:
caricato nel mio sito, lo script carica solo i file di piccola dimensione, provando quelli "più pesanti", tipo 3 MB o più lo script non carica nulla.
Mi aiutate a capire dove sbaglio? Grazie
Riporto interamente il file UPLOAD richiamato dal form

Codice PHP:
<?php

    define
("IMAGE_QUALITY"90);


    include(
"config.inc.php");

    
// inizializzazione
    
$result_final "";
    
$counter 0;

    
// List of our known photo types
    
$known_photo_types = array( 
                        
'image/pjpeg' => 'jpg',
                        
'image/jpeg' => 'jpg',
                        
'image/gif' => 'gif',
                        
'image/bmp' => 'bmp',
                        
'image/x-png' => 'png'
                    
);
    
    
// GD Function List
    
$gd_function_suffix = array( 
                        
'image/pjpeg' => 'JPEG',
                        
'image/jpeg' => 'JPEG',
                        
'image/gif' => 'GIF',
                        
'image/bmp' => 'WBMP',
                        
'image/x-png' => 'PNG'
                    
);

    
// Fetch the photo array sent by preupload.php
    
$photos_uploaded $_FILES['photo_filename'];

    
// Fetch the photo caption array
    
$photo_caption $_POST['photo_caption'];

    while( 
$counter <= count($photos_uploaded) )
    {
        if(
$photos_uploaded['size'][$counter] > 0)
        {
            if(!
array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
            {
                
$result_final .= "File ".($counter+1)." is not a photo
"
;
            }
            else
            {
                
mysql_query"INSERT INTO ".$db_prefix."gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );
                
$new_id mysql_insert_id();
                
$filetype $photos_uploaded['type'][$counter];
                
$extention $known_photo_types[$filetype];
                
$filename $new_id.".".$extention;

                
mysql_query"UPDATE ".$db_prefix."gallery_photos SET photo_filename='".addslashes($img_prefix.$filename)."' WHERE photo_id='".addslashes($new_id)."'" );

                
// Store the orignal file
                
move_uploaded_file($photos_uploaded["tmp_name"][$counter], $images_dir."/".$img_prefix.$filename);

                
// Let's get the Thumbnail size
                
$size GetImageSize$images_dir."/".$img_prefix.$filename );
                if(
$size[0] > $size[1])
                {
                    
$thumbnail_width 160;
                    
$thumbnail_height = (int)(160 $size[1] / $size[0]);
                }
                else
                {
                    
$thumbnail_width = (int)(120 $size[0] / $size[1]);
                    
$thumbnail_height 120;
                }
            
                
// Build Thumbnail with GD 1.x.x, you can use the other described methods too
                
$function_suffix $gd_function_suffix[$filetype];
                
$function_to_read "ImageCreateFrom".$function_suffix;
                
$function_to_write "Image".$function_suffix;

                
// Read the source file
                
$source_handle $function_to_read $images_dir."/".$img_prefix.$filename ); 
                
                if(
$source_handle)
                {
                    
// Let's create an blank image for the thumbnail
                         
$destination_handle Imagecreatetruecolor$thumbnail_width$thumbnail_height );
                
                    
// Now we resize it
                      
ImageCopyResampled $destination_handle$source_handle0000$thumbnail_width$thumbnail_height$size[0], $size[1] );
                }

                
// Let's save the thumbnail
                
$function_to_write$destination_handle$tb_images_dir."/tb_".$img_prefix.$filename );
                
ImageDestroy($destination_handle );
                
//

                
$result_final .= "[img]".$tb_images_dir"/tb_".$img_prefix.$filename."[/img] File ".($counter+1)." Added
"
;
            }
        }
    
$counter++;
    }

    
// Print Result
echo <<<__HTML_END

<html>
<head>
    <title>Photos uploaded</title>
</head>
<body>
    
$result_final
</body>
</html>

__HTML_END;
?>