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

  • Home
  • SEARCH
  • 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 523481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:28:01+00:00 2026-05-13T08:28:01+00:00

I have the following model(codeigniter) code to upload image and thumbnail. However the result

  • 0

I have the following model(codeigniter) code to upload image and thumbnail.

However the result of image path becomes, images/comfort_big.jpg and images/comfort_big.jpg.jpg.

The thumbnail image picks up the name of image and add .jpg.

I am uploading images/confort_thumb.jpg for thumb.

Can anyone tell me what’s wrong please?

if ($_FILES){
        $config['upload_path'] = './images/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '200';
        $config['remove_spaces'] = true;
        $config['overwrite'] = false;
        $config['max_width']  = '0';
        $config['max_height']  = '0';

        $this->load->library('upload', $config);    
        if (strlen($_FILES['image']['name'])){
            if(!$this->upload->do_upload('image')){
                $this->upload->display_errors();
                exit();
            }
            $image = $this->upload->data();
            if ($image['file_name']){
                $data['image'] = "images/".$image['file_name'];
            }
        }

        if (strlen($_FILES['thumbnail']['name'])){
            if(!$this->upload->do_upload('thumbnail')){
                $this->upload->display_errors();
                exit();
            }
            $thumb = $this->upload->data();
            if ($thumb['file_name']){
                $data['thumbnail'] = "images/".$thumb['file_name'];
            }
        }
    }
  • 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-13T08:28:01+00:00Added an answer on May 13, 2026 at 8:28 am

    I had a quick look at File Uploading Class in the user guide

    In the preferences tables it states:

    Note:The filename should not include a file extension.

    So my guess is that you get the user to name the file

    $config['file_name'] = "User defined";
    

    or remove the extension programmatically. Since you know and list the extensions already you could do

    $types = array(".gif",".jpg",".png"); 
    $image['file_name'] = str_replace($types , "", $image['file_name'] );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 341k
  • Answers 341k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If it is just removing of the diacritical marks, then… May 14, 2026 at 5:05 am
  • Editorial Team
    Editorial Team added an answer I'm not sure exactly what your end goal is, but… May 14, 2026 at 5:05 am
  • Editorial Team
    Editorial Team added an answer If a price should always be in effect, then I… May 14, 2026 at 5:05 am

Related Questions

I've run across an interesting PHP/SOAP error that has me stymied. After searching I
I am making a content entry with TinyMCE in codeigniter. However the output source
I've been using the CodeIgniter framework, however after learning Java and awesome features like
database.php : $db['default']['hostname'] = 192.168.2.104; $db['default']['username'] = webuser; $db['default']['password'] = ----; $db['default']['database'] = vad;
I have the following model: public class Model : INotifyPropertyChanged { public ObservableCollection<ViewElement> Elements

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.