Refactor file download code, and send messge when downloading file
Encode message when call send_message