PHP to get the breakpoint renewal code of the file

time:11-04-04 forum:PHP tools and code
  [code].lt;? Php
/ / / / / / / / / / / / / / / / / / / / / / / / / > if (! Is_file ($file)) {die (.Quot; 404 File not found!.quot;); Strrchr ($filename,.Quot;..quot;), 1)); / / / / obtain a file extension

/ / / / / / / / > switch ($file_extension) {
case.Quot. Ot; I am really wrong /zip.quot; break;
case.Quot; mp3.quot; $ctype=.quot; audio/mpeg.quot; break;
case; Is it really wrong, /force-download.quot;;
}

//Begin writing headers
header (.Quot; Cache-Control:.quot;);
> / > / > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > header. Strstr ($_SERVER.#91;'HTTP_USER_AGENT'.#93;.Quot; MSIE.quot;)) / / / / / / if IE browser
workaround for IE filename bug. $iefilename = preg_replace ('/. /' / ','. ', $filename, substr_count ($filename,'. ') - 1);
header (.Quot; Content-Disposition: attachment; filename=.quot; $iefilename.quot;}) T;);
}
header (.Quot; Accept-Ranges: bytes.quot;);

$size=filesize ($file);
/ / / > = > > / > / / > To request one or more sub ranges of an entity. For example, representing the first 500 bytes: bytes=0-499 represents second 500 bytes: bytes=500-999 represents the last 500 bytes: bytes=-500 represents the range after 500 bytes: bytes=500- first and last byte: bytes=0-0, -1 at the same time a few scopes: bytes =500-600601-999 But the server can ignore the request header, and if the unconditional GET contains the Range request header, the response will be returned with the state code 206 (PartialContent) instead of 200 (OK).
---------------------------*/

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Ot; -.quot; $range); / / what does this sentence do?
$size2=$size-1; / / / / file total byte number
$new_length=$size2-$range; / / / / obtain the next download length
header (.Quot; HTTP/1.1 206 Partial Content.quot;);
header. $range$size2/$size.quot;); when //Content-Range: bytes 4908618-4988927/4988928 95%,
} else / / / / / / / / / / > $size2=$size-1;
header (.Quot; Content-Range:); Ength:.Quot;.$size); / / / / output general
}
/ / / / / / > $fp=fopen (.Quot; $file.quot;.Quot; rb.quot;);
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / settings Ime_limit (0);
Print (FREAD ($fp, 1024*8)); / / / output file
flush (); / / / output buffer
ob_flush ();
}
; / / /
  • 2

prev:Opening of the Qianfo Hill matchmaking c... next:AM2 speed dragon 3200 processor UNIKA 69...
post comment
Notice



approved   These "90" in the mountains, the vil...   Chinese girls spend 4 years designin...   Chongqing version of "peach sister":...   Returnees in mountainous areas suppo...   Where is the old Ji'nan? More than 3...
rand   One to one substitution of the PHP a...   PHP gets and clears all the matching...   The difference and meaning of PHP re...   The function of the size of the PHP ...   The number of specified extension fi...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com