I did it!
In the end I used this tutorial .
Combining the .netrc file with FTP macros and bash script.
The .ntrc file provides security so that passwords are not stored in plain text.
Then the orders are given by macdef (FTP macros) .
At the end I invoke the macro created with a bash script.
The upload was made in binary format and it works.
I read that for the .txt files is advisable ascii.
But now that I work properly, I do not want to try anything else.
Did you see the solution I found in the previous answer ?
Thanks to you and caesar for their support .
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks