Completed writing the file sending code.