Copy large files (over 2 GB) in PHP
问题 I need to copy some big file (6 GB) via PHP. How can I do that? The Copy() function can't do it. I am using PHP 5.3 on Windows 32/64. 回答1: This should do it. function chunked_copy($from, $to) { # 1 meg at a time, you can adjust this. $buffer_size = 1048576; $ret = 0; $fin = fopen($from, "rb"); $fout = fopen($to, "w"); while(!feof($fin)) { $ret += fwrite($fout, fread($fin, $buffer_size)); } fclose($fin); fclose($fout); return $ret; # return number of bytes written } 回答2: If copy doesnt work,