Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

What must be done to make codeigniter force_download to download large files?

Hi Experts!

I'm facing problems when trying to download a 267Mb file by using Codeigniter's force_download.

When downloading smaller files, no problems.
User generated image
After a long time, the name of the file to be downloaded appears but without the size and after download
it the file has  0KB.

User generated image
After download:
User generated image
The code I used:
      $data = file_get_contents(base_url('arquivos/cesans/e_pub/' . $arquivo));
       force_download($arquivo, $data);

Open in new window


Thanks in advance!
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eduardo Fuerte

ASKER

Hello Dave

I did it before...
The directive in PHP.ini I changed was:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M

Open in new window


It was 128M before and causes a memory error.
Maybe it's still insuficient, I'm going to increase it to 1024M


User generated image
Am I in the right way?  Another directive must be changed too?

The file has 267M.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
After tests  1024M make it run OK!
In fact is an eBook !  The others are much smaller  treating agro subjects...but this is about the 100 better experimental receipts developed in our experimental kitchen...rsrsrs
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the assistance!