Given the explanation in the previous posts, you can redirect the standard error coming from the ftp command to a file, then check if the file has a size greater than zero and act accordingly, as in
Code:
ftp -inv << EOF 2> ftp.error
open IP-address
user USER PASSWORD
lcd /Dir
cd /Dir
binary
put $1
quit
EOF
test -s ftp.error && echo Failed || rm ftp.error
Furthermore you can parse the content of the file (if any) and take different actions upon different error messages.