Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3963768
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:15:16+00:00 2026-05-20T03:15:16+00:00

In my PHP site I have a script to upload images, see the script

  • 0

In my PHP site I have a script to upload images, see the script below

$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>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->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,";

            }

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.)

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:15:17+00:00Added an answer on May 20, 2026 at 3:15 am

    You have used a class Thumbnail to create a thumbnail image. But I guess you have missed to change the file permission in the new thumbnail image. Please check the code in the create() function of the class Thumbnail

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that is uploading images to my site, it works locally
I have a PHP-driven site that includes an XML stock feed, which is remotely
I have some code on my PHP powered site that creates a random hash
I have an existing site in php running on Apache using the mod_rewrite plug-in.
I have a site with URLs like this: http://domain.co.uk/subdir/page.php I have redesigned the site
In my (PHP) web app, I have a part of my site that keeps
I have a php script that handles the admin section/creation of pages for my
I have a site written in PHP utilizing PDO. I am using the bindParam()
I'm building a PHP site, but for now the only PHP I'm using is
I'm doing a PHP site which displays code examples in various languages (C#, PHP,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.