Add function force_download_large #1254

Closed
wants to merge 6 commits into from

3 participants

@tschechniker

Add function force_download_large for downloading large files by reade the content with chunks so that there is no need to load the complete file into the memory before send it to the client

@narfbg

Why not just add it as an option to the existing force_download() ?

@tschechniker

i made a new function because force_download expects that the content of the file already is in the memory. The force_download_large expects just the filepath so that it could read it in chunks. So the behavior is totaly different.

@philsturgeon

I agree that force_download should be improved. Maybe it should be allowed to take a filepath as well as a string, with an optional parameter as a switch.

@tschechniker

could be a solution but then the parameters will be changed and i think it is better when there will be a new function so that the upgrade from an old codeignter version to a new one will not make an error on this function

@philsturgeon
@tschechniker

I also get your mind. Maybe we could name it download_file or something so that we have two functions here one (force_download) for downloading content which is already loaded in the memory and one (download_file) for downloading a file which is on the filesystem

@narfbg

The second force_download() parameter could be used as a switch for that. It's currently used for holding the file contents, but it can e.g. be set to TRUE in case we want to read it in chunks instead.

@tschechniker

okay i will try this

@tschechniker tschechniker modify force_download to be able to give a array with path and name k…
…ey to download this in chunks (able to download large files)
e277322
@tschechniker

okay i have done this please review the code if this is okay i will write the user guide and the changes

@tschechniker

the only think i have made in another way was that i check the filename. If the filename is a array then i proceed with the new feature. The array could have 2 keys (path = path to file | name = the name which is going to download) hope this is okay too

@narfbg narfbg added a commit that referenced this pull request Nov 22, 2012
@narfbg narfbg Added support for stream-like downloads of existing files to force_do…
…wnload()

Based on code/ideas from PR #365, #1254
53fff91
@narfbg

See the above commit.

@narfbg narfbg closed this Nov 22, 2012
@nonchip nonchip pushed a commit to nonchip/CodeIgniter that referenced this pull request Jun 29, 2013
@narfbg narfbg Added support for stream-like downloads of existing files to force_do…
…wnload()

Based on code/ideas from PR #365, #1254
13d317f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment