Closed mrfatguy closed 10 years ago
Let's say it'll be a feature for some day ;) Thank you.
Well... it is your extension and your decision, so I respect it.
However, if someone can't or don't want to use mod-xsendfile
then your extension (with readfile
) will fail on files as small as 100 MB or even less. That isn't to much in nowadays. So, I would suggest to implement this ASAP, not "some day".
Especially, that I gave you a link to working, tested, ready-to-use code. So this is just a copy-paste job. And you're enhancing your extension with being able to handle files of up to 2 GB of size.
Let me put it another way: I have no intension on that "copy-paste job" anytime soon, as there are more interesting and urgent things I can apply.
However, this extension is not mine, in a sense that it's been given to the community somewhat four years ago. So if you do consider it ASAP, you're more than welcome to fork the code.
Per se I don't consider it a good idea to serve large files through PHP, yet for real urge we already have xsend. Closing now.
For your (and others) information:
mod-xsendfile
chokes on files like 50 MB in size. In nowadays, when GB of data are sent through websites / PHP, naming 50 MB files "large" is a bit old-fashioned. I don't think, there are many, that finds 50 MB file "large".Once again, going back, to my previous comment. These are mine, private opinions. And this is yours extension. If you find implementation of file chunking not worth, then this is fine with me. I've downloaded copy of your code and managed to extend it with file chunking, spending about 15 minutes on this issue. And I'm fine. End of conversation! :]
3., 2., 1. Use a webserver capabilities (xsend
in flavours is supported by all major players).
trejder would you mind sharing your implementation if it's done already?
@Cruiser13 Sure thing, but I'm going on a short, one-week vacation and won't have access to my repositories / code before end of it. So, I think you're going to do it yourself earlier! :] It's nothing else, than the code from my Stack Overflow answer, ported to CFile
extension (changing some variables).
CFile
offers support ofmod-xsendfile
plugin, if you're using Apache server and have it properly configured to use it. If not, it falls back to old, badreadfile
. This core PHP function will fail on files even as small as 100-200 MB, even if you have quite very high maximum memory limit set.What is the saddest, you may not even notice, that your script (that uses
CFile
, that usesreadfile
) fails, because -- due to some stupidity of PHP creators -- on certain server configurations, your file will be downloaded in this case, but instead of real content, it will contains a PHP generated HTML code with "exhausted memory" error message.You may consider implementing a workaround for this problem, for users, that can't use
mod-xsendfile
. You have to implement using of file chunking. Here you have my answer on Stack Overflow. Use provided code in place, whereCFile
extension callsreadfile
function.