Hello!
How could I replace first few bytes of a file with a string of my choice while using chunks-copying method for better handling of large files?
Code I have so far looks similar to this and it's only copying a file so far...
function copyFile($file_in, $file_out) {
$in = fopen($file_in, 'rb');
$out = fopen($file_out, 'wb');
while (!feof($in)) {
if (fwrite($out, fread($in, 1024)) === FALSE) {
return false;
}
}
fclose($in);
fclose($out);
return true;
}
Thanks for helping in advance!