Messo così non mi va... errore:
Warning: imagejpeg(): Unable to open 'new_/tmp/phpC1x2Dj' for writing in /mounted-storage/home11/sub001/sc16663-LKKM/www/save-ski-resort.php on line 80
La foto è stato inserita correttamente
Warning: imagejpeg(): Unable to open 'new_/tmp/php71DylS' for writing in /mounted-storage/home11/sub001/sc16663-LKKM/www/save-ski-resort.php on line 80
La foto è stato inserita correttamente

il codice è stato inserito così:

codice:
function resize_jpg_file ($img,$maxX = 220, $maxY = 170) 
 {$src = imagecreatefromjpeg($img);  
  $RealX = imagesx($src); 
  $RealY = imagesy($src); 
  if ($RealX > $maxX)  
    { 
     $newX = $maxX; 
     $newY = ($RealY/$RealX)*$newX; 
    } 
    else 
    { 
     $newY = $maxY; 
     $newX = ($RealX/$RealY)*$newY; 
    } 
   $dst = imagecreatetruecolor($newX, $newY);  
   imagecopyresized($dst, $src, 0, 0, 0, 0, $newX, $newY, $RealX, $RealY);  
   imagejpeg($dst, 'new_'.$img, 60);  
   return $dst; 
}

foreach ($_FILES["upfile"]["error"] as $key => $error) {

e giusta fare così?
$img = $_FILES["upfile"]["tmp_name"][$key];
ed io non ho la cartella /tmp...


   if ($error == UPLOAD_ERR_OK) {
       $tmp_name = $_FILES["upfile"]["tmp_name"][$key];
	   $nnow = time();
	   $nrandom = rand(100000000, 999999999);
	   $name = "".$nnow."-".$nrandom."-ski.jpg";
	   $name = ($name) ? $name : $_FILES["upfile"]["name"][$key];
	   resize_jpg_file ($img,$maxX = 220, $maxY = 170);
       move_uploaded_file($tmp_name, "upload/$name");
	   
	   $nome_foto = $name;
	   $query1 =mysql_query( "SELECT MAX(id_loc) FROM tab_loc");
	   $idrif_foto = mysql_result($query1,0,0);
	   $query = "INSERT INTO tab_foto (idrif_foto, nome_foto, cat_foto) VALUES ('$idrif_foto', '$name', 'localita')";
if (mysql_query($query, $db))
echo "La foto è stato inserita correttamente";
else
echo "Erorre durante l'inserimento";