ciao a tutti... ho realizzato un sistema cn il quale effettuo l'upload di immagini sul server... e caricandole le ridimensione creando una immagine "grande" e una "piccola"...da utilizzare per una galleria fotografica.... in locale tutto funziona alla perfezione... i problemi sono nati portando il tutto online...
nel file di log mi compare il seguente errore:
/home/hhh/public_html/management/image.class.php on line 31
[20-Nov-2005 21:29:28] PHP Warning: move_uploaded_file(./immagini/tmp/1132518568): failed to open stream: Permission denied in /home/hhh/public_html/management/upload.class.php on line 45
[20-Nov-2005 21:29:28] PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpLEXWva' to './immagini/tmp/1132518568' in /home/hhh/public_html/management/upload.class.php on line 45
[20-Nov-2005 21:29:28] PHP Warning: getimagesize(./immagini/tmp/1132518568): failed to open stream: No such file or directory in /home/hhh/public_html/management/image.class.php on line 31
i due file citati sono:
codice:
<?
class FileUpload{
var $up_dir; //la directory temporanea in cui verrà uploadata l'img
var $filename; //il nome del file
var $new_filename; //il nuovo nome del file se vogliamo rinominarlo
function FileUpload($up_dir){
$this->up_dir = $up_dir;
}
function RenameFile($new_filename){
$this->new_filename = $new_filename;
}
function Upload($files){
if(!file_exists($this->up_dir))
{
header("Location: {$destinazione}messaggio=Impossibile procedere con il caricamento dell'immagine a causa di un errore improvviso sul server (upload.class - function Upload).");
}
$this->filename = ($this->new_filename) ? $this->new_filename :$files['name'];
if(trim($files["name"]) == "")
{
header("Location: {$destinazione}messaggio=Non è stato indicato il file da caricare!");
}
if(is_uploaded_file($files["tmp_name"])){
move_uploaded_file($files["tmp_name"],$this->up_dir."/".$this->filename)
or header("Location: {$destinazione}messaggio=Impossibile procedere con il caricamento dell'immagine a causa di un errore improvviso sul server (upload.class - write permission).");
}else
{
header("Location: {$destinazione}messaggio=Impossibile procedere con il caricamento dell'immagine a causa di un errore improvviso sul server (upload.class - generic).");
}
}
function DeleteFile(){
unlink($this->up_dir . '/' . $this->filename);
}
}
?>
codice:
<?PHP
class Image{
var $src_filename;
var $src_witdh;
var $src_height;
var $src_type;
var $src_attr;
var $src_image;
function Image($filename){
$this->src_filename = $filename;
$this->GetImageInfo();
}
function GetImageInfo(){
list($this->src_width,$this->src_height, $this->src_type, $this->src_attr) = getimagesize($this->src_filename);
}
function CreateSourceImage(){
switch($this->src_type){
case 1:
$this->src_image =imagecreatefromgif($this->src_filename);
break;
case 2:
$this->src_image =imagecreatefromjpeg($this->src_filename);
break;
case 3:
$this->src_image =imagecreatefrompng($this->src_filename);
break;
default: return false;
}
return true;
}
function SaveProportionateImage($filename, $quality, $height){
$dest_height = $height;
$ratio = $this->src_height / $dest_height;
$dest_image = imagecreatetruecolor( $this->src_width / $ratio,$dest_height);
imagecopyresampled($dest_image, $this->src_image, 0, 0, 0, 0,
$this->src_width / $ratio,
$this->src_height / $ratio,
$this->src_width,
$this->src_height);
imagejpeg($dest_image, $filename.'.jpg', $quality);
imagedestroy($dest_image);
}
function Free(){
imagedestroy($this->src_image);
}
}
?>
Qualkuno mi sa dire il xke di questi problemi ke in locale non avevo ??
help
ciao ciao