Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fuel\Core\FuelException: The session data stored by the application in the cookie exceeds 4Kb.
  • Hello,
    I created a small script to upload photos.
    If I repeatedly use the form to upload photos I get this error:

    SCREAM: Error suppression ignored for

    Fatal error: Uncaught exception 'Fuel\Core\FuelException' with message 'The session data stored by the application in the cookie exceeds 4Kb. Select a different session storage driver.' in C:\wamp\www\rev\fuel\core\classes\session\driver.php on line 464


    Fuel\Core\FuelException: The session data stored by the application in the cookie exceeds 4Kb. Select a different session storage driver. in C:\wamp\www\rev\fuel\core\classes\session\driver.php on line 464

    How to selve it?

    my code:

    $carpeta='imgp';
                $config = array(
                'path' => DOCROOT.DS.$carpeta,
                'randomize' => true,
                'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'),
                );
                   Upload::process($config);

            // if a valid file is passed than the function will save, or if its not empty
                if (Upload::is_valid())
                   { Upload::save(); }

                // save them according to the config
                  if(Upload::get_files(0)){
                      foreach (Upload::get_files(0) as $key => $file){
                          $img1=$file;
                      }
                  } 

                 

                  if(Upload::get_files(1)){
                      foreach (Upload::get_files(1) as $key => $file){
                          $img2=$file;
                      }   
                  }

                 
                 
                  if(Upload::get_files(2)){
                      foreach (Upload::get_files(2) as $key => $file){
                          $img3=$file;
                      }   
                  }  

                  foreach (Upload::get_errors() as $key => $file)
                {
                    Session::set_flash('error', 'Ha ocurrido un error'.$file);
       
                    }

    I use fuelphp 1.4
    Thanks
  • As the message says, use a different storage backend, as the maximum size of a cookie is 4Kb.

    It looks like you're trying to store complete Validation error objects in the session, that will use up the available space very quickly...
  • I use a different storage backend.

    Do not output any error but the record is not saved in the database after the second record.

    I dont whant Validation error objects in the session, How to sovle this error?

    I just want to upload the files and save the route in bd.

    I need to create many records followed.
    And fuelphp just let me create 2-3 records followed
  • can someone help me ? 
    Thanks
  • You may have a different issue.

    Looking at the code again, you have a maximum of 3 uploaded files, so you store a maximum of 3 strings in the session. That should easily fit in a cookie, so your problem is elsewhere.

    p.s. get_errors() returns an array, so you can't do

    Session::set_flash('error', 'Ha ocurrido un error'.$file);

    as $file is an array...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion