got it to work using fseek, feel like a bozo posting this when it was my lack of thinking in the first place as to why it didn't work. thanks all for the help... Scott
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can you help explain this code? It looks like you're on the right track but > have a few flaws (at first glance). > > > <?php > > session_cache_limiter('public'); > > session_start(); > > Is there a reason to be using sessions here? > > > set_time_limit(0); > > $file=$_REQUEST['file']; > > $extstart=strpos($file, "."); > > What does $extstart contain now? > > > $ext=substr($file, $extstart+1); > > So $ext is now a piece of the file. Why? > > > $dir="d:\\downloadable_courses"; > > $size=filesize($dir."\\".$file); > > header("Accept-Ranges: bytes"); > > So $size is now the size of the entire file (not the piece). > > > if(isset($_ENV['HTTP_RANGE'])) { > > list($a, $range)=explode("=",$_ENV['HTTP_RANGE']); > > So $a is now bytes, and $range is something like 123-456 > > > str_replace($range, "-", $range); > > This makes no sense. The range requested is bytes 123 through 456, and you're > converting this to 123456. Why? > > > $size2=$size-1; > > header("Content-Range: $range$size2/$size"); > > $new_length=$size2-$range; > > This will definitely not work, based on my comments above. > > If someone sends this header: > > Range: bytes=0-1023 > > and your resource is 2048 bytes in size, your response should include this > header: > > Content-Range: bytes 0-1023/2048 > > Work on generating the correct string before you bother actually using them as > headers and trying for the full solution. > > Hope that helps. > > Chris > > ===== > Become a better Web developer with the HTTP Developer's Handbook > http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php