Saves a PDF to disk

@param  string $sPath     The path to save to
@param  string $sFilename The filename to give the PDF

@return boolean
978361
public function save($sPath, $sFilename)
    {
        if (!is_writable($sPath)) {
            $this->setError('Cannot write to ' . $sPath);
            return false;
        }

        $this->oDomPdf->render();
        $bResult = (bool) file_put_contents(
            rtrim($sPath, '/') . '/' . $sFilename,
            $this->oDomPdf->output()
        );

        $this->reset();

        return $bResult;
    }
890464
public function save( $fileName = false )
	{
		if( !$fileName )
		{
			if( !$this->fileName )
				throw new RuntimeException( 'No TBZ file name for saving given.' );
			$fileName = $this->fileName;
		}
		$this->generateTar();												// Encode processed files into TAR file format
		$f = new FS_File_Arc_Bzip( $fileName );
		$f->writeString( $this->content );
		return true;
	}
941684
public function push( $sFileName, $mFileContent )
    {
        $sPath = $this->_getCacheFilePath( $sFileName );

        if ( is_null( $sPath ) ) {
            return false;
        }

        return file_put_contents( $sPath, serialize( $mFileContent ) );
    }
16786
public static function save($key, string $filename = ''): bool
    {
        if ($key instanceof KeyPair) {
            return self::saveKeyFile(
                $filename,
                $key->getSecretKey()->getRawKeyMaterial()
            );
        }
        return self::saveKeyFile($filename, $key->getRawKeyMaterial());
    }
1192037
public function writeFile($filename)
    {

        if (!$filename) {
            trigger_error(ReporticoLang::templateXlate("UNABLE_TO_SAVE") . templateXlate("SPECIFYXML"), E_USER_ERROR);
            return false;
        }

        if (!preg_match("/\.xml$/", $filename)) {
            $filename = $filename . ".xml";
        }

        $projdir = $this->query->projects_folder . "/" . ReporticoApp::getConfig("project");
        if (!is_file($projdir)) {
            ReporticoUtility::findFileToInclude($projdir, $projdir);
        }

        if ($projdir && is_dir($projdir)) {

            $fn = $projdir . "/" . $filename;
            if (!($fd = @fopen($fn, "w"))) {

                trigger_error("Unable to open project file " . $fn . " for writing. Check folder and file permissions " , E_USER_ERROR);
                return false;
            }
        } else {


            trigger_error("Unable to open project area " . ReporticoApp::getConfig("project") . " to save file $filename " .
                $this->query->reports_path . "/" . $filename . " Not Found", E_USER_ERROR);
        }

        if (!fwrite($fd, '<?xml version="' . $this->xml_version . '"?>')) {
            return false;
        }

        $xmltext = $this->xmldata->unserialize();
        if (!fwrite($fd, $xmltext)) {
            return false;
        }

        fclose($fd);

    }
200825
public function saveFile($containerName, \SplFileInfo $file, $relativePath)
    {
        $fileName = $file->getFilename();
        $filePath = $this->getFullFileName($containerName, $fileName, $relativePath);

        return $this->move($file->getRealPath(), $filePath);
    }
293521
protected function createPath(string $sPath): BaseMaker
    {
        if (!is_dir($sPath)) {
            if (!@mkdir($sPath, self::FILE_PERMISSION, true)) {
                throw new DoesNotExistException('Path "' . $sPath . '" does not exist and could not be created');
            }
        }

        if (!is_writable($sPath)) {
            throw new IsNotWritableException('Path "' . $sPath . '" exists, but is not writable');
        }

        return $this;
    }
112086
public function saveCallData( string $hash, $data, int $lenght ): bool
	{
		$this->storage->save($hash, $data, $lenght);
		return true;
	}
928830
public function pop( $sFileName )
    {
        $sPath = $this->_getCacheFilePath( $sFileName );

        if ( is_null( $sPath ) ) {
            return false;
        }

        if ( $this->_expired( $sPath ) ) {
            @unlink( $sPath );

            return false;
        }

        return unserialize( file_get_contents( $sPath ) );
    }
840412
final public function saveImage($filename)
	{
		$extension = pathinfo($filename, PATHINFO_EXTENSION);

		if (! is_string($extension)) {
			$extension = image_type_to_extension($this->_image_type);
			$filename .= ".{$extension}";
		}

		switch(strtolower($extension))
		{
			case 'jpeg':
			case 'jpg':
				return $this->imageJPEG($filename);
				break;

			case 'png':
				return $this->imagePNG($filename);
				break;

			case 'gif':
				return $this->imageGIF($filename);

			default:
				trigger_error('Invalid extension or not an image', E_USER_WARNING);
				return false;
		}
	}
69445
public function saveHTMLFile($filename)
    {
        if (!is_writable($filename)) {
            return false;
        }
        $result = $this->saveHTML();
        file_put_contents($filename, $result);
        $bytesWritten = filesize($filename);
        if ($bytesWritten === strlen($result)) {
            return $bytesWritten;
        }
        return false;
    }
1242873
public function saveFile($filename, array $params = [])
    {
        $fp = fopen($filename, 'w');
        fwrite($fp, $this->xmlString($params));
        fclose($fp);

        return $this;
    }
351169
protected function _getHashedFileDir($sFileHash)
    {
        $sDir = substr($sFileHash, 0, 2);
        $sAbsDir = $this->_getBaseDownloadDirPath() . DIRECTORY_SEPARATOR . $sDir;

        if (!is_dir($sAbsDir)) {
            mkdir($sAbsDir, 0755);
        }

        return $sDir;
    }
873216
public function copyFile($fileName, $storageName = '', $newDest)
    {
        //check whether file is set or not
        if ($fileName == '' || $newDest == '') {
            AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
            throw new Exception(Exception::MSG_NO_FILENAME);
        }

        //build URI
        $strURI = $this->strURIFile . $fileName . '?newdest=' . $newDest;
        if ($storageName != '') {
            $strURI .= '&storage=' . $storageName;
        }

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
        $json = json_decode($responseStream);

        if ($json->Code === 200) {
            return true;
        }

        return false;
    }
1336235
@Override
	public boolean saveFile(final ITileSource pTileSource, final long pMapTileIndex,
			final InputStream pStream, final Long pExpirationTime) {

		final File file = getFile(pTileSource, pMapTileIndex);

		if (Configuration.getInstance().isDebugTileProviders()){
			Log.d(IMapView.LOGTAG, "TileWrite " + file.getAbsolutePath());
		}
		final File parent = file.getParentFile();
		if (!parent.exists() && !createFolderAndCheckIfExists(parent)) {
			return false;
		}

		BufferedOutputStream outputStream = null;
		try {
			outputStream = new BufferedOutputStream(new FileOutputStream(file.getPath()),
					StreamUtils.IO_BUFFER_SIZE);
			final long length = StreamUtils.copy(pStream, outputStream);

			mUsedCacheSpace += length;
			if (mUsedCacheSpace > Configuration.getInstance().getTileFileSystemCacheMaxBytes()) {
				cutCurrentCache(); // TODO perhaps we should do this in the background
			}
		} catch (final IOException e) {
			Counters.fileCacheSaveErrors++;
			return false;
		} finally {
			if (outputStream != null) {
				StreamUtils.closeStream(outputStream);
			}
		}
		return true;
	}
947485
static function storeDOM( $filename, $dom )
    {
        $bytes = $dom->save( $filename );

        if ( $bytes !== false )
        {
            eZPackage::applyStorageFilePermissions( $filename );

            eZDebugSetting::writeNotice( 'kernel-ezpackage-store',
                                         "Stored file $filename",
                                         'eZPackage::storeDOM' );
            return true;
        }
        else
        {
            eZDebug::writeError( "Saving DOM tree to $filename failed", __METHOD__ );
        }

        return false;
    }
1236362
public static function save($filename='excel', $format='Xlsx')
    {
        $objPhpSpreadsheet = self::validExcelObj();

        // Create Writer first
        $objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPhpSpreadsheet, $format);

        /**
         * Type Mapping
         */
        $inTypeList = isset(self::$_writerTypeInfo[$format]) ? true : false;
        $extension = ($inTypeList) ? self::$_writerTypeInfo[$format]['extension'] : '';
        
        // Check if filename contained extension
        $filepath = (stripos($filename, $extension)===(strlen($filename)-strlen($extension)))
            ? $filename 
            : "{$filename}{$extension}";

        // Save file
        $objWriter->save($filepath);
        return $filepath;
    }