public function uploadFile(string $file, string $path, string $name)
    {
        // to store the file we have to make sure the directory exists
        foreach ($this->extractDirectories($path) as $dir) {
            // if change to directory fails
            // create the dir and change into it afterwards
            try {
                $this->chDir($dir);
            } catch (\Exception $e) {
                $this->mkDir($dir);
                $this->chDir($dir);
            }
        }
        if (!$this->put($name, $file, FTP_BINARY)) {
            $error   = error_get_last();
            $message = $error['message'];
            throw new RuntimeException(sprintf('error uploading file: %s - %s', $file, $message));
        }
    }
public function uploadFile(string $file, string $path, string $name)
    {
        // to store the file we have to make sure the directory exists
        foreach ($this->extractDirectories($path) as $dir) {
            // if change to directory fails
            // create the dir and change into it afterwards
            try {
                $this->chDir($dir);
            } catch (\Exception $e) {
                $this->mkDir($dir);
                $this->chDir($dir);
            }
        }
        if (!$this->put($name, $file, FTP_BINARY)) {
            $error   = error_get_last();
            $message = $error['message'];
            throw new RuntimeException(sprintf('error uploading file: %s - %s', $file, $message));
        }
    }
public function uploadFile ( string $ file , string $ path , string $ name ) { // to store the file we have to make sure the directory exists foreach ( $ this -> extractDirectories ( $ path ) as $ dir ) { // if change to directory fails // create the dir and change into it afterwards try { $ this -> chDir ( $ dir ) ; } catch ( \ Exception $ e ) { $ this -> mkDir ( $ dir ) ; $ this -> chDir ( $ dir ) ; } } if ( ! $ this -> put ( $ name , $ file , FTP_BINARY ) ) { $ error = error_get_last ( ) ; $ message = $ error [ 'message' ] ; throw new RuntimeException ( sprintf ( 'error uploading file: %s - %s' , $ file , $ message ) ) ; } }
Upload local file to ftp server.

@param  string $file Path to local file that should be uploaded.
@param  string $path Path to store the file under.
@param  string $name Filename on the ftp server.
@return void
Upload local file to ftp server .