Salve, sapreste dirmi perchè questo script non funziona:

Codice PHP:
<?php
if(isset($_FILES['immagine'])){
        
$x_thumb 48;
        
$temp $_FILES['immagine']['tmp_name'];
        
$dim getimagesize($temp);
        
$y_thumb $dim[1]/$dim[0]*$x_thumb;
        
$im imagecreatetruecolor($x_thumb$y_thumb);
        if (
$dim[2] == 1)
                
$im_or imagecreatefromgif($temp);
        elseif(
$dim[2] == 2)
                
$im_or imagecreatefromjpeg($temp);
        elseif(
$dim[2] == 3)
                
$im_or imagecreatefrompng($temp);
        
imagecopyresampled($im$im_or0000$x_thumb$y_thumb$dim[0], $dim[1]);
        
imagejpeg($im,'immagine',70);
        
imagedestroy($im_or);
        
imagedestroy($im);
        
// leggo la thumbnail appena creata per inserirla nel db
        
$data addslashes(fread(fopen('immagine.temp''rb'), filesize('immagine')));
        
unlink('immagine');
} else {
        echo 
'
        <form action="prova.php" method="post" enctype="multipart/form-data">
        <input type="file" name="immagine" />
        <input type="submit" value="invia" />
        </form>
        '
;
}
?>

Io ho assegnato al file i privileggi 777, ma mi da errore quando eseguo lo script :


Warning: fopen(immagine.temp): failed to open stream: No such file or directory in /home/secaleys/public_html/test00/prova.php on line 19

Warning: fread(): supplied argument is not a valid stream resource in /home/secaleys/public_html/test00/prova.php on line 19



e mi genera un file nella cartella dove è situato lo script chiamato error_log con questo contenuto:

[28-Apr-2005 11:00:04] PHP Warning: fopen(immagine.temp): failed to open stream: No such file or directory in /home/secaleys/public_html/test00/prova.php on line 19
[28-Apr-2005 11:00:04] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/secaleys/public_html/test00/prova.php on line 19
[28-Apr-2005 11:01:29] PHP Warning: fopen(immagine.temp): failed to open stream: No such file or directory in /home/secaleys/public_html/test00/prova.php on line 19
[28-Apr-2005 11:01:29] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/secaleys/public_html/test00/prova.php on line 19