[Linux-programlama] move_uploaded_file sorunu

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Erdal YAZICIOGLU (erdal.yazicioglu@gmail.com)
Date: Wed 29 Aug 2007 - 17:09:48 EEST


Merhaba,

 

Yazdığım scripte şöyle bir hata alıyorum

 

Warning: move_uploaded_file() [function.move-uploaded-file
<http://test.gbhlmd.org/function.move-uploaded-file> ]: SAFE MODE
Restriction in effect. The script whose uid is 10094 is not allowed to
access /var/www/vhosts/karakacan.org/subdomains/test/httpdocs/erdal_images/1
owned by uid 33 in
/var/www/vhosts/karakacan.org/subdomains/test/httpdocs/operations.php on
line 378

 

Google da bayağı bir baktım ancak sonuç yok ...

 

Yapmak istediğim şu... Kullanıcı siteye giriş yaptığı anda userID si
session'a yazılyor. Daha sonra resim upload etmek istiyorum. Ancak resimleri
upload ederken edal_images dizini altında userID si ile bir klasör yaratsın
istiyorum. Bu klasörün altına da bu resmi atsın istiyorum.

 

Benim makinemde safe_mode=off ve gayet iyi açlışıyor ancak host un
makinesinde on bu nedenle mi acaba hata alıyorum. Script aşağıda... Bu
sorunu nasıl aşabilirim...

 

$image_size = $_FILES['image_filename']['size'];
$image_tempname = $_FILES['image_filename']['name'];
$today = date("YmdHms");
if($image_size > 150000) {
    $_SESSION['size_error'] = " Dosya boyutunuz 150KB olması gerekmektedir";
    $redirect = "profile.php?op=photo";
           header ("Refresh: 0; URL=" . $redirect . "");
           exit();
}

//upload image and check for image type
$ImageDir ="erdal_images/". $_SESSION['userID']."/";
if(file_exists($ImageDir)) {
        $ImageDir= $ImageDir;
}else {
    mkdir($ImageDir,0777);
    $ImageDir= $ImageDir;
    }

$ImageThumb = $ImageDir;

$ImageName = $ImageDir . $image_tempname;

if (move_uploaded_file($_FILES['image_filename']['tmp_name'],
                      $ImageName)) {

   list($width, $height, $type, $attr) = getimagesize($ImageName);

  if ($type > 3) {
        $_SESSION['type_error'] = "Resimleriniz sadece GIF,JPG ve PNG
formatında olabilir.";
        $redirect = "profile.php?op=photo";
           header ("Refresh: 0; URL=" . $redirect . "");
  } else {
  $newfilename = $ImageDir . "Erdal" . $today . $_SESSION['userID'] .
".jpg";

  //**insert these lines
  if ($type == 2) {
    rename($ImageName, $newfilename);
  } else {
    if ($type == 1) {
      $image_old = imagecreatefromgif($ImageName);
    } elseif ($type == 3) {
      $image_old = imagecreatefrompng($ImageName);
    }

    //"convert" the image to jpg
    $image_jpg = imagecreatetruecolor($width, $height);
    imagecopyresampled($image_jpg, $image_old, 0, 0, 0, 0,
                     $width, $height, $width, $height);
    imagejpeg($image_jpg, $newfilename);
    imagedestroy($image_old);
    imagedestroy($image_jpg);
  }

  $newthumbname = $ImageThumb . "ErdalThumb" . $today . $_SESSION['userID']
. ".jpg";

  $thumb_width = $width * 0.10;
  $thumb_height = $height * 0.10;

  //create the thumbnail
  $largeimage = imagecreatefromjpeg($newfilename);
  $thumb = imagecreatetruecolor($thumb_width, $thumb_height);
  imagecopyresampled($thumb, $largeimage, 0, 0, 0, 0,
                    $thumb_width, $thumb_height, $width, $height);
  imagejpeg($thumb, $newthumbname);

  imagedestroy($largeimage);
  imagedestroy($thumb);
}

 }

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.