بک لینک

موضوع بسته شده است 
مشکل در php
#1
سلام دوستان ببینید این کد رو من نوشتم برای آپلود توی دایرکتوری حالا فک کنم یه ایرادی داره اجرا نمیشه میشه یه نگاه بندازید؟
کد:
<?php
// Set the target directory for the uploaded files.
// Make sure the folder exists on the server and the permissions are set to 777!
$uploaddir = './uploads/';
// Set accepted file extensions.
$allowed   = array('jpg','jpeg','gif','pdf');
// Set the max. size of an uploaded file. 1024*1024 means 1 MB. The max. upload size is also limited by server settings.
$max_size  = 1024 * 1024;
// Set the success page when the file has been uploaded succesfully.
$success_url = './thanks.html';

if (isset($_FILES['file']))
{
   foreach ($_FILES['file']['error'] as $i => $error)
   {
      if ($error == 0 && $_FILES['file']['size'][$i] <= $max_size)
      {
         $file_ext  = pathinfo($_FILES['file']['name'][$i],PATHINFO_EXTENSION);
         $file_name = basename($_FILES['file']['name'][$i],'.'.$file_ext);
         if (in_array(strtolower($file_ext), $allowed))
         {
            $new_base = $_FILES['file']['name'][$i];
            $t = 1;
            while (file_exists($uploaddir.$new_base))
            {
               $new_base = $file_name.'['.$t.'].'.$file_ext;
               $t++;
            }
            if (move_uploaded_file($_FILES['file']['tmp_name'][$i],$uploaddir.$new_base))
            {
               chmod($uploaddir.$new_base, 0644);
               header('Location: '.$success_url);
            }
         }
      }
   }
}
?>
افزایش و تامین امنیت سایت و سرور
پ.خ/YAHOO ID : kazemiy64
موضوع بسته شده است 


پرش به انجمن:


کاربرانِ درحال بازدید از این موضوع: 1 مهمان