Copy file from FTP server to New file in Machine

Thanks you Tavix for your promp reply.

For txt file this code not working. I dont know why ? if you can help out. ! I tried for docx file. Its copying the content and storing.

But when I try to open the docx file its giving a error in msword

“The File NewTest cannot be opened because there are problems with the content”

Then I say OK to that and new pop up

“Word found unreadable content in NewTest. Do you want to recover the contents of this document ? If you trust the source of this document.”

Then I say yes and its displaying the content.

Same occcurs when I try rar file or zip file.

Also if use txt . Its empty.

Hope you got me.

Thanks in advance .