Autor | Zpráva | ||
---|---|---|---|
Lukáš Přibyl Profil * |
#1 · Zasláno: 24. 8. 2008, 21:11:35
Potřeboval bych poradit s uploadem fotek na web. Na localhostu mi to funguje, ale po nahrání na webhosting mi to píše chyby. Jedná se o nějaký problém s právy, ale složka foto, kam se mají fotky nahrávat má práva 777. Chtělo by to asi nastavit práva přímo tomu souboru, ale to nevím jak.
Hlášky: Warning: imagejpeg() [function.imagejpeg]: Unable to open 'foto.jpg' for writing: Permission denied in /home/www/neco.cz/subdomeny/www/upload.php on line 54 Warning: copy(foto.jpg) [function.copy]: failed to open stream: Permission denied in /home/www/neco.cz/subdomeny/www/upload.php on line 40 Warning: copy() [function.copy]: Unable to access foto.jpg in /home/www/neco.cz/subdomeny/www/upload.php on line 62 Warning: unlink(foto.jpg) [function.unlink]: No such file or directory in /home/www/neco.cz/subdomeny/www/upload.php on line 63 function image_shrink_size($file_in, $max_x = 0, $max_y = 0) { list($width, $height) = getimagesize($file_in); if (!$width || !$height) { return array(0, 0); } if ($max_x && $width > $max_x) { $height = round($height * $max_x / $width); $width = $max_x; } if ($max_y && $height > $max_y) { $width = round($width * $max_y / $height); $height = $max_y; } return array($width, $height); } function image_resize($file_in, $file_out, $width, $height) { $imagesize = getimagesize($file_in); if ((!$width && !$height) || !$imagesize[0] || !$imagesize[1]) { return false; } if ($imagesize[0] == $width && $imagesize[1] == $height) { return copy($file_in, $file_out); } switch ($imagesize[2]) { case 1: $img = imagecreatefromgif($file_in); break; case 2: $img = imagecreatefromjpeg($file_in); break; case 3: $img = imagecreatefrompng($file_in); break; default: return false; } if (!$img) { return false; } $img2 = imagecreatetruecolor($width, $height); imagecopyresampled($img2, $img, 0, 0, 0, 0, $width, $height, $imagesize[0], $imagesize[1]); if ($imagesize[2] == 2) { return imagejpeg($img2, $file_out); } elseif ($imagesize[2] == 1 && function_exists("imagegif")) { imagetruecolortopalette($img2, false, 256); return imagegif($img2, $file_out); } else { return imagepng($img2, $file_out); } } if ($_FILES['foto_inzerat']['type'] == "image/jpeg" OR $_FILES['foto_inzerat']['type'] == "image/pjpeg") $typ = "jpg"; $obrazek = "foto.".$typ.""; list($width, $height) = image_shrink_size($_FILES["foto_inzerat"]["tmp_name"], 150, 200); if ($width && $height) { image_resize($_FILES["foto_inzerat"]["tmp_name"], $obrazek, $width, $height); } $slozka = "foto/"; $celyobrazek = $slozka; $celyobrazek .= $obrazek; copy($obrazek, $celyobrazek); unlink($obrazek); |
||
ninja Profil |
#2 · Zasláno: 24. 8. 2008, 21:54:37
PHP funkce chmod ()
|
||
Lukáš Přibyl Profil * |
#3 · Zasláno: 24. 8. 2008, 22:05:35
ninja
a pro co mám ten chmod použít? složka již má práva 777. A jak tím chmodem nastavím práva přímo na tu fotku? |
||
bukaj Profil |
#4 · Zasláno: 24. 8. 2008, 22:11:33
|
||
Časová prodleva: 16 let
|
0