Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSV download is not working Magento 1.9.2.3

I had created a module in magento to export some custom data for customer in excel sheet and when the user clicks on link it used to get exported and downloaded but now its stopped working suddenly. I see the file being created in my var folder but its not getting downloaded whatsoever

    $csv->saveData($fileName, $customersArray);

    $this->_prepareDownloadResponse($fileName, array('type' => 'filename', 'value' => $fileName));

   $this->loadLayout();
   $this->_title($this->__("Customer Export"));
   $this->renderLayout();
like image 902
Harshada Chavan Avatar asked Nov 08 '22 10:11

Harshada Chavan


1 Answers

What is the file size ?

As you said that you can see the file being created in your var folder but user can't download it, it may probably due to the PHP or web server settings.


Concerning php configuration, try to update your php.ini file with:

Upload_max_filesize  = 1500 M
Max_input_time  = 1000
Memory_limit    = 640M
Max_execution_time =  1800
Post_max_size = 2000 M

Save your php.ini and restart your server.

source: this answer


If it is not the server, you may also add this line to your index.php file (or your main script file):

ini_set('upload_max_filesize', '1500M');
ini_set('memory_limit', '640M');

You may also add or modify the .htaccess file in the download directory (/var/download) with this:

<Files *.*>
 ForceType applicaton/octet-stream
</Files>
like image 54
A STEFANI Avatar answered Dec 21 '22 21:12

A STEFANI