Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kerberos

Pages: [1]
1
Mods & Plugins (Releases & Support) / Re: [MOD] Resume download
« on: September 07, 2005, 01:17:02 PM »
This mod addicted to users who has 56Kb dial-up connection...and useful for downloading big files.... and.... its really outstanding  8)

2
[EDIT by V@no]
This mod does not work properly.
Moved to the end of the forum untill problem resolved
[/EDIT]

Hi ;)
This mod allows you to resume broken downloads.

open download.php

find
Code: [Select]
$user_access = get_permission();
add after
Code: [Select]
$rangeheader=getenv("HTTP_RANGE");
$rangeheader=str_replace("bytes=","",$rangeheader);
$range=explode("-", $rangeheader);
$offset1=$range[0];
$offset2=$range[1];

find
Code: [Select]
function get_file_data($file_path) {
  global $script_url;

replace
Code: [Select]
global $script_url;with
Code: [Select]
global $script_url,$offset1,$offset2;
find and comment out
Code: [Select]
  ob_start();
  @ob_implicit_flush(0);
  @readfile($file_path);
  $file_data = ob_get_contents();
  ob_end_clean();

add after commented

Code: [Select]
  $fp=fopen($file_path,"rb");
  fseek($fp,$offset1);
  if (empty($offset2)) $offset2=filesize($file_path)-1;
  $file_data=fread($fp, $offset2-$offset1);
  fclose($fp);

find
Code: [Select]
else {
  echo $lang['download_error']."\n<!-- NO ACTION SPECIFIED //-->";
  exit;
}

if (!empty($file['file_data'])) {

add after
Code: [Select]
  header("HTTP/1.1 206 Partial Content");

find
Code: [Select]
  else {
    header("Content-Disposition: attachment; filename=\"".$file['file_name']."\"\n");
    header("Content-Type: application/octet-stream\n");
  }

add after
Code: [Select]
  header("Accept-Ranges:bytes");
  header("Content-Range:bytes ${offset1}-${offset2}/".filesize($file["file_path"]));
  header("Connection:close");
  header("Content-Length: ".($offset2-$offset1)."\n\n");

Pages: [1]