Hej, jeg får denne fejl på mit webhotel
Warning: imagejpeg() [function.imagejpeg]: Unable to access upload/small825686Unavngivet.JPG in /home/lala.dk/web/www/lala/uptest.php on line 56
Warning: imagejpeg() [function.imagejpeg]: Invalid filename 'upload/small825686Unavngivet.JPG' in /home/lala.dk/web/www/lala/uptest.php on line 56
men får den ikke på hotserv.dk's webhotel ?
havd kan det skyldes?
Her får i koden:
<?php
$konfiguration["upload_bibliotek"] = "./upload/";
$konfiguration["max_stoerrelse"] = "1000000000";
$fra = $_FILES["upfil"]["tmp_name"];
$fra2 = $_FILES["upfil"]["name"];
$til = $konfiguration["upload_bibliotek"] . $_FILES["upfil"]["name"];
$fil_stoerrelse = filesize($fra)/1024;
if($fil_stoerrelse > $konfiguration["max_stoerrelse"]) {
die("Filen er for stor");
}
if(function_exists("move_uploaded_file")) {
move_uploaded_file($fra, $til);
$newfilename = "".rand(1, 1000000)."".$fra2."";
$newfilename2 = "upload/". $newfilename ."";
rename($til, $newfilename2);
} else {
copy($fra, $til);
rename($til, $newfilename2);
}
$pic = "upload/". $newfilename ."";
$thumb = "upload/small". $newfilename ."";
Thumb($pic, $thumb);
function Thumb($sourcefile, $targetfile) {
$size = 230;
switch ($_FILES['upfil']['type']) {
case "image/gif":
$source_id = imageCreateFromGIF($sourcefile);
break;
case "image/jpeg":
$source_id = imageCreateFromJPEG($sourcefile);
break;
case "image/png":
$source_id = imageCreateFromPNG($sourcefile);
break;
default:
echo "Sorry, but the file you uploaded was not a GIF, JPG, or .PNG file.<br>";
}
#$source_id = $format;
#$source_id = imageCreateFromJPEG($sourcefile);
$source_x = imagesx($source_id);
$source_y = imagesy($source_id);
$delta = $size/max($source_x, $source_y);
$dest_x = round($source_x*$delta);
$dest_y = round($source_y*$delta);
$target_id=imagecreatetruecolor($dest_x, $dest_y);
imagecopyresampled($target_id,$source_id,0,0,0,0, $dest_x,$dest_y, $source_x,$source_y);
switch ($_FILES['upfil']['type']) {
case "image/gif":
imagegif($target_id,$targetfile,100);
break;
case "image/jpeg":
imagejpeg($target_id,$targetfile,100);
break;
case "image/png":
imagepng($target_id,$targetfile,100);
break;
default:
echo "Sorry, but the file you uploaded was not a GIF, JPG, or .PNG file.<br>";
}
}
?>
Marc Zacho
www.senia.dk - www.hcparty.dk