title: File permission to PHP uploaded image
body: <p>In my PHP site I have a script to upload images, see the script below </p>
  
  <pre><code>$uploaddir = $root_path."images/uploaded_images/category/"; 
              $small_file_name = trim($_FILES['cat_image1']['name']);
              $small_file_len = strlen($small_file_name);
              $small_file_ext = strtolower(substr($small_file_name,-4)); // select last 4 characters
              $small_uploadfile = $uploaddir. $_FILES['cat_image1']['name'];  
              if($small_file_len&gt;4 and ($small_file_ext==".gif" or $small_file_ext==".jpg" or $small_file_ext=="jpeg")){
                  if ($small_file_ext=="jpeg")
                      $uniqname = uniqid(rand()).".".$small_file_ext;
                  else
                      $uniqname = uniqid(rand()).$small_file_ext;
                  $thumb_filename1 = "thumb_".$uniqname;  //  store uniqname into database
                  $uploadfile = $uploaddir.$uniqname; //uncomment for local testing 
                  if (move_uploaded_file($_FILES['cat_image1']['tmp_name'], $uploadfile)) {
                      chmod($uploadfile,0777);
                      list($width, $height, $type, $attr) = getimagesize($uploadfile);
                      $max_width = 276;
                      $max_height = 162;
                      $a = new Thumbnail($uploadfile,$max_width,$max_height,$uploaddir.$thumb_filename1,100,'');
                      $a-&gt;create();
  
                  }else{  
                          $flag=1;
                          $frm_server_side_error= $frm_server_side_error."Error in uploading image,";
                  }
              }
              else{
                  $flag=2;
                  $frm_server_side_error= $frm_server_side_error."Image not in gif or jpg format,";
  
              }
  </code></pre>
  
  <p>After uploading in to the server its can't be see (I am displaying the thumb image). So I checked the file permission of that image through the FTP and give read permission. Thus image displays. But I give the read and write permission to the category folder and it’s parent folders. How can view the image after uploading (default read permission to the uploading files ie thumb image.)</p>
  
  <p>I noticed that the actual image have read permission but the thumb image doesn't have the read permission. I need to display only the thumb image.</p>