writing the file to temp and further sending to client when complete
error handling done