I have an FTP class that has the function of connecting, disconnecting, downloading and uploading files to another ftp server.
I have this function, and I wanted to register the reason for the download failure in a text file, but based on ftp_put documents, this returns false only when an error occurs :
public function upload($remote_file, $file, $mode = FTP_ASCII) { if (!ftp_put($this->ftp_connection, $remote_file, $file, $mode)) { throw new Exception("There was a problem while uploading $file", 1); } $this->last_uploaded_file = $file; return true; }
Is there any way to get the cause of the failure for ftp_put ? And what are these reasons? Or is the only error message that I could log is something like a generic message ?:
Error loading file Foo.bar 12:01:01 2015-01-01
source share