Welcome Guest, Not a member yet? Register   Sign In
force_download improved (partial download, speed limit and more)
#11

[eluser]Donald Hughes[/eluser]
Okay, I can't seem to figure out how to turn on output buffering so that flush() actually does something. Anyone have any suggestions? I'm using WebFaction, if that makes a difference.
#12

[eluser]Wilker[/eluser]
i dont know what is webfaction XD

but, if you can setup your server, try to do this using XAMPP (www.apachefriends.org), the XAMPP instalation enables streaming Wink
#13

[eluser]Donald Hughes[/eluser]
Sorry, WebFaction (webfaction.com) is a popular webhost known for being friendly to "agile" technologies like ROR and Python. Do you have any idea what XAMPP does in it's configuration to allow this to work? I'm on a mac using MAMP, so I'll give that a shot as well. Thanks again for the help.
#14

[eluser]Donald Hughes[/eluser]
I figured out the problem. It had nothing to do with output buffering. The problem was that I was passing in a full url path (http://domain/dir/file.mov), and I guess PHP's file_exists() function does not work with full urls. So I was getting the blank page because it was failing that check and returning false. I commented that check out and it downloaded just fine.
#15

[eluser]Wilker[/eluser]
you can use force_download instead of has output buffering, but has one difference:

if you do using output with streamming enable, you free memory in each cycle, but if you hasn't streamming, all output is putted into output buffer, that accumulate memory usage of server... because of this i told you about problem without streamming Wink
#16

[eluser]Unknown[/eluser]
Hello Wilker,

First of all, thanks for your code. Currently We have file upload/download script which have running on two server means server A is running the code and Server B just only store the files. When we upload a file, we placed the files to Server B through ftp and when download I used your script to download from Server B. I tried to download with IDM (Internet Download Manager), normally when I download files directly from Server B, it's downloaded with maximum 8 connection, but when i download through my website (script), it only connected as 1 connection and others connections doesn't work. So my download speed from script only get around maximum 20kb when comparing with direct download speed maximum 200kb. Can you please help us that how can we do to make it work ? Thanks for your time.

With Regards,
#17

[eluser]Lowkase[/eluser]
This function is no longer working with Chrome (3.0.195.27).

Works in every other browser I have tested, but with Chrome a download dialog box is never displayed.


Cheers,

Lowkase


*Update*
Interesting, its working today, perhaps a caching issue?

Regardless, here is the code I am using to call the updated force_download function provided by the author of this thread:

Code:
function download($file_name)
        {
            // Declarations
            $result = FALSE;

            if( isset( $file_name ) )
            {
                if( file_exists( PUBPATH . '/uploads/' . $file_name ) )
                {
                    $result = $this->force_download(PUBPATH . '/uploads/' . $file_name);
                }
            }

            return $result;
        }
#18

[eluser]Unknown[/eluser]
loved the function! Great post! I was totally confused about how to limit downloading speed and u really made my life easy.
Is there a similar easy way to limit the uploading speed??

regards,
Mohsin
#19

[eluser]Unknown[/eluser]
Perfect ...
The files would not open after downloaded in chrome and now work perfectly

thank you




Theme © iAndrew 2016 - Forum software by © MyBB