Welcome Guest, Not a member yet? Register   Sign In
Posting a too long textarea
#1

[eluser]Shella[/eluser]
Hello there,
I'm encountering troubles trying to post a textarea content. 37203 characters.
Basically I got a Internal Server Error (500)

I'm sure the issue is related to the long content because if I send a smaller text everything goes fine.

I'm using ckeditor to manage the textarea.

Here codes

View
Code:
...
<textarea name="content" id="content_2" >Example data</textarea>
<?php echo display_ckeditor($ckeditor_2); ?>
...

Controller
Code:
function write_article()
{
  
  if($this->input->post('submit'))
  {
   $this->load->model('Images_model');
   $data['filename'] = $this->Images_model->do_upload();
   //$this->load->view('prova', $data);
  }
  
  $this->load->library('form_validation');
  $this->form_validation->set_error_delimiters('<h4 class="alert_error">', '</h4>');
  //field name, error message, validation rules
  
  $this->form_validation->set_rules('title', 'Title', 'trim|required');
  $this->form_validation->set_rules('content', 'Content', 'trim|required');
  
  if($this->form_validation->run() == FALSE)
  {
   $this->create_article();
  }
  else
  {
   $this->load->model('articles_model');
  
   if($query = $this->articles_model->create_article($data))
   {
    $this->edit_article();
   }
   else
   {
    $this->load->view('backend_create_article');
   }
  }
  
}

Model
Code:
...
function create_article($data)
{
  
  $created_on = date ("Y-m-d H:i:s", time());
  
  $new_article_insert_data = array(
  'title' => $this->input->post('title'),
  'content' => $this->input->post('content'),
  'created_on' => $this->input->post('datepicker'),
  'image' => $data['filename'],
  'id_category' => $this->input->post('category'),
  'created_on' =>  $created_on,
  );
  
  $insert = $this->db->insert('articles', $new_article_insert_data);
  return $insert;
}
...

Thanks in advance

Shella
#2

[eluser]LaPouleLustucru[/eluser]
Hi,

Maybe should you check your PHP.INI directives ? specially MEMORY_LIMIT and POST_MAX_SIZE

Code:
&lt;?php echo php_info; ?&gt;

should do the trick.

If necessary you may increase the first one locally, inside your controller, like this :
Code:
function write_article()
{
    ini_set('memory_limit', '256M');

    ...

POST_MAX_SIZE has to be set in php.ini or .htaccess

For instance in php.ini :
Code:
memory_limit = 256M
post_max_size = 16M
#3

[eluser]Aken[/eluser]
Check your log files for CI and/or the server to see if there are any errors that are being reported besides the 500 error, so you can track down the actual problem.
#4

[eluser]Shella[/eluser]
[quote author="LaPouleLustucru" date="1358298825"]Hi,

Maybe should you check your PHP.INI directives ? specially MEMORY_LIMIT and POST_MAX_SIZE

Code:
&lt;?php echo php_info; ?&gt;

should do the trick.

If necessary you may increase the first one locally, inside your controller, like this :
Code:
function write_article()
{
    ini_set('memory_limit', '256M');

    ...

POST_MAX_SIZE has to be set in php.ini or .htaccess

For instance in php.ini :
Code:
memory_limit = 256M
post_max_size = 16M
[/quote]

Hey thanks to reply. Unfortunaltely this is not related to the max_post_size. 37000 chars should be no more then 37kb and my limit is set to 8MB.

Thanks anyway
#5

[eluser]Shella[/eluser]
[quote author="Aken" date="1358316029"]Check your log files for CI and/or the server to see if there are any errors that are being reported besides the 500 error, so you can track down the actual problem.[/quote]

Hi Aken,
where can I find the CI log files?
Indeed the error invite me to "handle the error" but I don't know how to do with CI.

Thanks in advance
#6

[eluser]Shella[/eluser]
Hi there,
just an update. I tried some other ways.

I tried to post with no CkEditor and I have the same error.
I tried to understand where the characters are too muanies and it seem over 18000

I checked my max_post_size in phpinfo() and the limit is set to 8mb (should be enough....)


Any suggestions please?


Shella
#7

[eluser]InsiteFX[/eluser]
post_max_size and upload_max_filesize both have to match the size.

php.ini
Code:
; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size = 128M

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 128M
#8

[eluser]Harold Villacorte[/eluser]
Hey there if you are still and you have not looked at your database make sure the field type is not anything smaller than TEXT.
#9

[eluser]InsiteFX[/eluser]
For database text fields you can use:
Code:
TINYTEXT   256           bytes
TEXT       65,535        bytes ~64kb
MEDIUMTEXT 16,777,215    bytes ~16MB
LONGTEXT   4,294,967,295 bytes ~4GB




Theme © iAndrew 2016 - Forum software by © MyBB