I'm trying to write a server, which can download files in a piece-wise manner. So, if the connection is interrupted, next time the same client connects, the download can resume from where it stopped.
Now, suppose when the client opens the webpage, the server starts reading files saved on it, in the following manner:
$handle = fopen($file_in, "rb");
$handle_2 = fopen($file_out, "w");
$contents = fread($handle, filesize($file_in));
fwrite($handle_2, $contents);
Of course, the fwrite won't work with files on the client's computer.
So basically my question is, how do I send data to a file on the client's pc, once I have the file contents?