$file_size]); fastcgi_finish_request(); $rfile = fopen ($remote, "rb"); if ($rfile) { $dfile = fopen ($dpath, "wb"); if ($dfile) { while(!feof($rfile)) { fwrite($dfile, fread($rfile, 1024 * 8 ), 1024 * 8 ); } } } if ($rfile) { fclose($rfile); } if ($dfile) { fclose($dfile); } } if($action == "get_file_size") { if(file_exists($dpath)) echo json_encode(["size"=>filesize($dpath)]); else echo json_encode(["size"=>0]); }