[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FTPAPI] Reply message from ftp_put
Hello Luciano,
The ftp_put() routine is designed to make it easy to handle errors.
ftp_put() will return 0 if it was able to successfully transfer the
file, or -1 if any error occurred.
You don't need to look at the underlying FTP protocol message (like
226), you can simply check the return value.
Example:
rc = ftp_put(session: tofile: fromfile );
if (rc = 0);
// success!
else;
error_msg = ftp_errorMsg(session);
endif;
Or even easier:
if ftp_put(session: tofile: fromfile ) <> 0;
error_msg = ftp_errorMsg(session);
endif;
It only returns 0 if the file transfer was successful. If you get a 0,
it means it was transferred. No need to parse/understand the raw FTP
protocol data. It does the work for you.
On 12/13/2010 8:49 AM, Luciano Vigna wrote:
>
> How can retrieve the message response from the ftp_put command?
> (i.e. "226 File upload OK" or any error message), we need to know if
> the file was upload correctly or not.
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------