Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-09T02:34:43-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16194 2011-12-09T02:34:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=56127#p56127 <![CDATA[Re: Using X-Sendfile for downloads]]>

Statistics: Posted by Cristián Lávaque — December 9th, 2011, 2:34 am


]]>
2011-12-07T21:40:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=56024#p56024 <![CDATA[Re: Using X-Sendfile for downloads]]>
Code:
$file = $vars['file'];
$filename = basename($file);
$length = filesize($file);
header("USING_XSENDFILE: TRUE"); //for testing
header("X-Sendfile: $file");
header("Content-Length: $length");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$filename\"");

Statistics: Posted by fx_keith — December 7th, 2011, 9:40 pm


]]>
2011-12-07T21:31:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=56022#p56022 <![CDATA[Re: Using X-Sendfile for downloads]]>

Statistics: Posted by Raam Dev — December 7th, 2011, 9:31 pm


]]>
2011-12-07T03:33:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=55951#p55951 <![CDATA[Re: Using X-Sendfile for downloads]]> Note to anyone else doing this, the filepath in this example would simply be $vars['file'];

Statistics: Posted by fx_keith — December 7th, 2011, 3:33 am


]]>
2011-12-07T02:58:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=55949#p55949 <![CDATA[Re: Using X-Sendfile for downloads]]> ws_plugin__s2member_during_file_download_access
viewtopic.php?f=40&t=13012&src_doc_v=111206#src_doc_line_274

Something like this perhaps.
Code:
<?php
add_action 
("ws_plugin__s2member_during_file_download_access", "my_s2_file_server");
function my_s2_file_server ($vars = array ())
    {
        if ($vars["serving"])
            {
                // Send file headers, and exit script execution.
                print_r($vars); // For debugging.
                exit ();
            }
    }
?>

Statistics: Posted by Jason Caldwell — December 7th, 2011, 2:58 am


]]>
2011-12-05T15:19:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16194&p=54602#p54602 <![CDATA[Using X-Sendfile for downloads]]>
Looking at classes/files-in.inc.php it looks like files are downloaded towards the end of 'c_ws_plugin__s2member_files_in::check_file_download_access', but I'm not seeing something I can plug into without clobbering all the file checking.

Ideally, I'd like to replace all the file headers in line #331
Code:
else /* Else, ``if ($serving)`` , use local storage option (default).*/
with an X-Sendfile header like:
Code:
header("X-Sendfile: $file_path");


Any suggestions on accomplishing that?

Statistics: Posted by fx_keith — December 5th, 2011, 3:19 pm


]]>