public function saveToCdn($sFilename, $sBucket = null)
    {
        if (Components::exists('nails/module-cdn')) {

            //  Save temporary file
            $sCacheDir  = CACHE_PATH;
            $sCacheFile = 'TEMP-PDF-' . md5(uniqid() . microtime(true)) . '.pdf';
            if ($this->save($sCacheDir, $sCacheFile)) {

                $oCdn    = Factory::service('Cdn', 'nails/module-cdn');
                $oResult = $oCdn->objectCreate(
                    $sCacheDir . $sCacheFile,
                    $sBucket,
                    ['filename_display' => $sFilename]
                );

                if ($oResult) {

                    @unlink($sCacheDir . $sCacheFile);
                    $this->reset();
                    return $oResult;

                } else {
                    $this->setError($oCdn->lastError());
                    return false;
                }

            } else {
                return false;
            }

        } else {
            $this->setError('CDN module is not available');
            return false;
        }
    }
public function saveToCdn($sFilename, $sBucket = null)
    {
        if (Components::exists('nails/module-cdn')) {

            //  Save temporary file
            $sCacheDir  = CACHE_PATH;
            $sCacheFile = 'TEMP-PDF-' . md5(uniqid() . microtime(true)) . '.pdf';
            if ($this->save($sCacheDir, $sCacheFile)) {

                $oCdn    = Factory::service('Cdn', 'nails/module-cdn');
                $oResult = $oCdn->objectCreate(
                    $sCacheDir . $sCacheFile,
                    $sBucket,
                    ['filename_display' => $sFilename]
                );

                if ($oResult) {

                    @unlink($sCacheDir . $sCacheFile);
                    $this->reset();
                    return $oResult;

                } else {
                    $this->setError($oCdn->lastError());
                    return false;
                }

            } else {
                return false;
            }

        } else {
            $this->setError('CDN module is not available');
            return false;
        }
    }
public function saveToCdn ( $ sFilename , $ sBucket = null ) { if ( Components :: exists ( 'nails/module-cdn' ) ) { //  Save temporary file $ sCacheDir = CACHE_PATH ; $ sCacheFile = 'TEMP-PDF-' . md5 ( uniqid ( ) . microtime ( true ) ) . '.pdf' ; if ( $ this -> save ( $ sCacheDir , $ sCacheFile ) ) { $ oCdn = Factory :: service ( 'Cdn' , 'nails/module-cdn' ) ; $ oResult = $ oCdn -> objectCreate ( $ sCacheDir . $ sCacheFile , $ sBucket , [ 'filename_display' => $ sFilename ] ) ; if ( $ oResult ) { @ unlink ( $ sCacheDir . $ sCacheFile ) ; $ this -> reset ( ) ; return $ oResult ; } else { $ this -> setError ( $ oCdn -> lastError ( ) ) ; return false ; } } else { return false ; } } else { $ this -> setError ( 'CDN module is not available' ) ; return false ; } }
Saves the PDF to the CDN

@param  string $sFilename The filename to give the object
@param  string $sBucket   The name of the bucket to upload to

@return mixed             stdClass on success, false on failure
Saves the PDF to the CDN