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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:59:12+00:00 2026-05-28T03:59:12+00:00

I am receiving the error You did not select a file to upload. When

  • 0

I am receiving the error “You did not select a file to upload.” When I am attempting to upload a photo using this code:

function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('session');
$this->load->library('form_validation');
$this->form_validation->set_rules('title', 'title', 'trim|required|max_length[255]');
$this->form_validation->set_rules('description', 'description', 'trim|required|max_length[2550]');
$this->form_validation->set_error_delimiters('<p class="error">', '</p>');

$data['title'] = $this->input->post('username');
$data['description'] = $this->input->post('description');
if($this->form_validation->run() == FALSE)
{
  $this->load->view('upload_form', $data);
}
else
{
  $this->load->helper('string');
  $config['upload_path'] = realpath($_SERVER['DOCUMENT_ROOT'] . '/uploads') . '/';
  $config['allowed_types'] = 'gif|jpg|png';
  $config['max_size'] = '5000';
  $config['max_width'] = '10240';
  $config['max_height'] = '10240';
  $config['overwrite'] = FALSE;
  $config['file_name'] =  random_string('alpha', 6);
  $config['remove_spaces'] = TRUE;

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

  if(!$this->upload->do_upload('file'))
  {
    $error = array('upload_message' => $this->upload->display_errors());
    $this->load->view('upload_form', $error);
  }
  else
  {
    //do upload stuff
  }
}

And this is the view:

<?php echo form_open('upload'); ?>
<h5>Title: </h5>
<br />
<?php echo form_input('title', set_value('title')); ?>
<?php $a = form_error('title'); ?>
<br />
<?php echo '<h5>'; echo $a=="" ? '<br />' : $a.'<br />'; echo '</h5>'; ?>
<h5>Description: </h5>
<br />
<?php echo form_textarea('description', set_value('description')); ?>
<?php $a = form_error('description'); ?>
<br />
<?php echo '<h5>'; echo $a=="" ? '<br />' : $a.'<br />'; echo '</h5>'; ?>
<h5>Upload: </h5>
<br />
<?php echo form_upload('file'); ?>
<?php $a = (isset($upload_message) ? $upload_message : "<br/>&nbsp<br /><br />"); ?>
<?php echo '<h5>'; echo $a=="" ? '<br />a' : $a.''; echo '</h5>'; ?>
<br />
<?php echo form_submit('upload', 'Upload'); ?>
<?php form_close(); ?>

I have made a test upload form with the same config and it works perfectly. When I try and use this form however, I am receiving the error “You did not select a file to upload.”

  • 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-28T03:59:13+00:00Added an answer on May 28, 2026 at 3:59 am

    You need to use form_open_multipart() instead of form_open(). Your test script couldn’t have possibly worked without this.

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

Sidebar

Related Questions

I am not sure what the problem is but I keep receiving this error
I am receiving this error "error: no matching function for call to ‘ros::NodeHandle::subscribe(const char
I'm receiving the error 'currentUpdateMethod' undeclared (first use in this function). The variable this
Attempting to build .exe using py2exe: python setup.py py2exe , receiving error: ImportError: No
I am currently receiving this error: Validation of viewstate MAC failed. If this application
I'm receiving this error in my Linq statement --- Cannot implicitly convert type 'System.Collections.Generic.IEnumerable'
I am receiving this error. I have no clue as to why it would
I'm receiving suddenly this error on a Win2003 Server Web Application: Microsoft VBScript runtime
I am receiving the following error in my code (c#, .Net 3.5, VS2008) when
while working with linq query i'm receiving error System.NullReferenceException: Object reference not set to

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.