5

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();
Harshada Chavan
  • 526
  • 3
  • 13
  • most of the implementations http://inchoo.net/magento/tracing-magento-from-export-csv-to-save-file-ok-button/ and https://github.com/drAlberT/magento-custom-export/blob/master/app/code/local/Lema21/CustomExport/controllers/IndexController.php does not have any code after _prepareDownloadResponse, did you add this recently? – Vikram Palakurthi Mar 29 '18 at 15:24
  • No, Previously it was working fine. I think increased data has caused this. but then Magento can export larger CSVs of product data I dont understand why 6000+customer data export is a problem here – Harshada Chavan Mar 30 '18 at 05:07

1 Answers1

1

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>
A. STEFANI
  • 6,707
  • 1
  • 23
  • 48
  • ERR_CONTENT_LENGTH_MISMATCH - File size is 3.34MB – Harshada Chavan Mar 30 '18 at 13:13
  • Sometime the limit is 2MB (maybe 3MB in your case), in my opinion the increase of file size and the fact that it reach the max limit, could explain that it stopped working suddenly. Could you try another export with an output file under 2MB or 3MB to confirm ? – A. STEFANI Mar 30 '18 at 13:18