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 7770297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:22:32+00:00 2026-06-01T16:22:32+00:00

In my code below it seems that the image does not get uploaded when

  • 0

In my code below it seems that the image does not get uploaded when the folder is created but if I go back and refresh the previous page and try it again with the folder created the image gets uploaded,

Do I have to move the upload stuff into the is_dir if statement but what happens in an instance when the folder is already created what goes in the else?

$conceptOne = 'conceptOne';
        $conceptTwo = 'conceptTwo';

        $location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/';

        $folderName = $this->quote->getCompanyDetails()->companyName;
        $folderName = str_replace(" ", "_", $folderName);
        $folderName = strtolower($folderName);


        if(!is_dir($location.$folderName))
        {   
            mkdir($location.$folderName);
            chmod($location.$folderName, 0777);

        }else{

        //Set File Settings 
          $config['upload_path'] = $location.$folderName; 
          $config['allowed_types'] = 'jpg|png|pdf'; 
          $config['file_name'] = $conceptOne;
          $config['remove_spaces'] = TRUE;
          $config['overwrite'] = TRUE;
          $config['max_size'] = '1024'; 
          $config['max_width'] = '1024'; 
          $config['max_height'] = '768'; 

          $this->load->library('upload', $config); 

            print_r($config);

          if(!$this->upload->do_upload($conceptOne)) { #= try upload

            $data['uploadError'] = array('uploadError' => $this->upload->display_errors()); #Error

            $this->load->view('layout', $data);

      } // Do upload
          else{
            $data = array('upload_data' => $this->upload->data($conceptOne));

          }// end else
        }// end if folde
  • 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-06-01T16:22:34+00:00Added an answer on June 1, 2026 at 4:22 pm

    Remove the else above

    //Set File Settings 
    

    So that the block beneath it is no longer in that condition.

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

Sidebar

Related Questions

The below code seems like it should work; however, the blob in the database
i use below code - Just try again. - to prevent deadlock. it seems
I'm using the below code for a rollover effect, seems to be working okay!
The code below removes www., etc. from the beginning of websites that are entered
I have a query that works in phpmyadmin however does not work in my
For some reason this PHP code below will not work, I can not figure
The wxPython ToolBar look and feel does not match that of the current operating
Hey all i am trying to get my code below to work in order
The code below doesn't seem to work or find anything on an array. I'm
Code below is working well as long as I have class ClassSameAssembly in same

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.