Fix CURL error handling in FTP upload hook