Re: Reg - Video File Chunk issue
Benjamin <[email protected]> Thu, 18 Jul 2024 20:55:39 +0800
| Newsgroups | gmane.comp.php.general |
|---|---|
| Message-ID | <[email protected]> |
fread does not return the exactly size of bytes. You should process it manually
while (!feof($fp)) {
$chunk += fread($fp, 4 * 1024 * 1024); // chunk the file as 4MB
while( $chunk.length >= 4M) {
$chunk4m = $chunk.substring(0, 4M);
fwrite(file, chunk4m)
$chunk = $chunk.substring(4M)
}
}
> On Jul 18, 2024, at 4:34 PM, Raghul Tlv <[email protected]> wrote:
>
> while (!feof($fp)) {
> $chunk = fread($fp, 4 * 1024 * 1024); // chunk the file as 4MB
> }