0

I hope somebody can help me with this.

I want to export a html table in excel, I used PHP using this code:

<?php
  header("Content-type: application/vnd.ms-excel; name='excel'");
  header("Content-Disposition: filename=".$_POST['filename']);
  header("Pragma: no-cache");
  header("Expires: 0");
  echo $_POST['datos_a_enviar'];
?>

The PHP receives a string from another page, and I test it and actually receive the string correctly , however when exporting to Excel, the file you exported is completely empty , even the weight of the file in disk is 0. This only happens when there are many records , because with few records, the excels have the data.

When I was testing in localhost, the excel exports all the data, but when I uploaded to the server, that happens, with a lot of regs, the file is empty.

Thanks for the help, I hope someone can help me.

1 Answers1

0

You must check the server limitation for the POST size. If you're working with PHP under Linux or similar, you can control these using .htaccess, like so:

#set max post size
php_value post_max_size 20M

PHP has other limits on script time, so if you say it takes lots of regs, maybe it is that:

Try tweaking the max_execution_time and memory_limit variables in php.ini. If you don't have access to php.ini, try the set_time_limit and/or ini_set functions.

J. Chomel
  • 8,193
  • 15
  • 41
  • 69