Jump to content

phntje

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by phntje

  1. <?php $link = "http://host.com/link.rar"; $baselink = basename($link); $time = time(); $date = date("D, d M Y H:i:s \G\M\T" , $time); header("Content-Disposition: attachment; filename=$baselink"); header('Expires: '.gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y"))).' GMT'); header("Content-Description: File Transfer"); header("Content-Type: application/octet-stream"); header("Accept-Ranges: bytes"); $sizeheaders = get_headers($link, 1); $size = $sizeheaders["Content-Len gth"]; if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); //if yes, download missing part str_replace($range, "-", $range); $size2=$size; $new_length=$size2-$range; header("HTTP/1.1 206 Partial Content"); header("Status: 206 Partial Content"); header("Content-Le ngth: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size; //header("Content-Range: bytes 0-$size2/$size"); header("Content-Le ngth: ".$size2); } @readfile($link); ?> Downloading in firefox & other browsers is okay. But when using downloadmanagers, then its downloading the file but the file is corrupt, it's 1 or 2 bytes bigger then the original file. How to fix this?
  2. I'm getting this error when i want to post in PHP Help Not Acceptable An appropriate representation of the requested resource /forums/index.php could not be found on this server.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.