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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:11:41+00:00 2026-05-30T11:11:41+00:00

My HTML: <?php echo form_open_multipart(base_url() . ‘user/’ . $this->session->userdata[‘username’] . ‘/settings/picture’); ?> <input type=file

  • 0

My HTML:

<?php echo form_open_multipart(base_url() . 'user/' . $this->session->userdata['username'] . '/settings/picture'); ?>
    <input type="file" name="photo_data" id="photo_data" value="" />
    <input type="submit" value="Save" name="submit" class="button_ui fr" />
<?php form_close(); ?>

So the user goes to its settings page and clicks Picture Tab in the menu which then shows the above HTML and allows the user to update the picture.

I then went into my user controller and tried to check if the user is in the picture tab and print out the data being sent so i can continue coding the rest part… but the thing is that it doesnt print the picture that i select to upload…

My controller code:

if ($this->uri->segment(4) == 'picture'){
    if (isset($_POST["submit"])){
        print_r($_POST);
    }
}

Output:

Array ( [submit] => Save Changes ) 
  • 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-30T11:11:43+00:00Added an answer on May 30, 2026 at 11:11 am

    As The Maniac pointed out, file uploads are stored in the $_FILES global, not $_POST. But you don’t even need to use these with CodeIgniter (so long as it’s one file upload you’re doing). In your controller, you can use CI’s build-in file upload class:

    public function do_upload()
    {
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '100';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
    
        $this->load->library('upload', $config);
    
        // Automatically finds your user's file in $_FILES
        if ( ! $this->upload->do_upload())
        {
            $error = array('error' => $this->upload->display_errors());
            $this->load->view('upload_form', $error);
        }
        else
        {
            $data = array('upload_data' => $this->upload->data());
            $this->load->view('upload_success', $data);
        }
    }
    

    If you’re uploading multiple files, you’ll need to do a foreach loop with $_FILES. Find out more about it in their documentation. Also, you can minimize your code in your view with something like:

    <?php 
       echo form_open_multipart('user/'.$this->session->userdata['username'].'/settings/picture'); ?>
       echo form_upload(array('name'=>'photo_data','id'=>'photo_data'));
       echo form_submit('submit','Save');
       echo form_close(); 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am generating the following html form with this php: echo <form name=\userForm\> Username:
Often when writing PHP I'll have it output some HTML like this - echo
e.g. some html.... <p class=date><?php echo $date; ?></p> more html... ?
Here is my code <html> <body> <?php echo <b>Hello World</b> <br />; ?> </body>
I currently call a function to filter some HTML in PHP like this FilterHTML($string)
HTML <form action='insert.php' method='POST'> <p><b>Client:</b><input type='text' name='idclient'/> <p><b>Total:</b><br /><input type='text' name='total'/> <p><input type='submit' value='Save'
I have this piece of PHP/HTML, wrapped in a POST form. How do I
<script type='text/javascript'> $(document).ready(function() { $(#specific_consultant_yes).click(function() { $('.specific').show('slow'); $.post(<?php echo $this->url(array('controller'=>'appointment', 'action' =>'available'),'default',true)?>,{app_date:$(#App_date).val(),consultant:$(#Consultants).val()} ,function(data){ $(.new).html(data);
I am trying to code an all in one HTML/PHP contact from with error
Embedding HTML within .PHP files is one of the primary functionalities of PHP, but

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.