0

This is my front-end code. THis is small form with one input for file upload.

<form class="" method="POST" action="<?php echo base_url();?>adminpanel/upload" enctype="multipart/form-data">

                          <input type="file" name="file">
                        <div class="widget-footer">
                            <button class="btn btn-primary" type="submit">Save</button>

                        </div>
                      </form>

When I hit the Save button, the following PHP script is executed:

 function upload()
    {      
           ini_set('upload_max_filesize', '10M');
           ini_set('post_max_size', '10M');
           if (!empty($_FILES))
        {
            $config['upload_path'] = './uploads/';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '2000';


            $this->load->library('upload', $config);
            if ($this->upload->do_upload())
            {   //success
                $data = array('upload_data' => $this->upload->data());
            }


        }
                redirect("/home");
    }

But instead of successful file upload, I get following message:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log

When I go to the Apache log, there is following error:

[Mon Nov 25 15:57:08 2013] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

What is happening here?

MrD
  • 2,423
  • 3
  • 33
  • 57
  • 1
    `redirect("")`? redirect to itself? so you post to a script, that script redirects to itself, no upload is done, so it redirects again to itself, etc...? – Marc B Nov 25 '13 at 15:13
  • No it is not, it will redirect to the base_url! – MrD Nov 25 '13 at 16:16

1 Answers1

0

Maybe you should call redirect("/"); or redirect(base_url().'adminpanel/');

Or move this redirect into curly braces of if (!empty($_FILES)).

Andrew
  • 1,756
  • 3
  • 18
  • 31
  • Did it, but still the same issue! – MrD Nov 25 '13 at 15:32
  • http://stackoverflow.com/questions/17669712/php-upload-and-internal-server-error This post is somehow connected with my question, but can't find FcgidMaxRequestLen 67108864 in my WAMP server. – MrD Nov 25 '13 at 15:32