/** * Uploads a file to the server. * * @param string $local_file * @return FtpClient * @throws FtpException When the transfer fails */ public function putFromPath($local_file) { $remote_file = basename($local_file); $handle = fopen($local_file, 'r'); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { rewind($handle); return $this; } throw new FtpException('Unable to put the remote file from the local file "' . $local_file . '"'); }