You could have a fixed length buffer (i.e. 512 or 1024 bytes). Then read the file (buffer length) bytes at a time and send it that way. On the other side, it doesn't really matter how big the buffer is. Just receive as much as you can (check the return of recv()), and write to the new file the number of bytes you received.
And yeah, you find the file size and do what Salem said about sending the file length first (i.e. a standard long header).