library/core/class.filesystem.php
public static function SaveFile($FileName, $FileContents, $Flags = VANILLA_FILE_PUT_FLAGS) {
   
      // Check that the folder exists and is writable
      $DirName = dirname($FileName);
      $FileBaseName = basename($FileName);
      if (!is_dir($DirName))
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed because target folder [%2$s] does not exist.',$FileBaseName,$DirName));
         
      if (!IsWritable($DirName))
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed because target folder [%2$s] is not writable.',$FileBaseName,$DirName));
         
      if (file_put_contents($FileName, $FileContents, $Flags) === FALSE)
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed!',$FileBaseName));

      return TRUE;
   }
public static function SaveFile($FileName, $FileContents, $Flags = VANILLA_FILE_PUT_FLAGS) {
   
      // Check that the folder exists and is writable
      $DirName = dirname($FileName);
      $FileBaseName = basename($FileName);
      if (!is_dir($DirName))
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed because target folder [%2$s] does not exist.',$FileBaseName,$DirName));
         
      if (!IsWritable($DirName))
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed because target folder [%2$s] is not writable.',$FileBaseName,$DirName));
         
      if (file_put_contents($FileName, $FileContents, $Flags) === FALSE)
         throw new Exception(sprintf('Requested save operation [%1$s] could not be completed!',$FileBaseName));

      return TRUE;
   }
public static function SaveFile ( $ FileName , $ FileContents , $ Flags = VANILLA_FILE_PUT_FLAGS ) { // Check that the folder exists and is writable $ DirName = dirname ( $ FileName ) ; $ FileBaseName = basename ( $ FileName ) ; if ( ! is_dir ( $ DirName ) ) throw new Exception ( sprintf ( 'Requested save operation [%1$s] could not be completed because target folder [%2$s] does not exist.' , $ FileBaseName , $ DirName ) ) ; if ( ! IsWritable ( $ DirName ) ) throw new Exception ( sprintf ( 'Requested save operation [%1$s] could not be completed because target folder [%2$s] is not writable.' , $ FileBaseName , $ DirName ) ) ; if ( file_put_contents ( $ FileName , $ FileContents , $ Flags ) === FALSE ) throw new Exception ( sprintf ( 'Requested save operation [%1$s] could not be completed!' , $ FileBaseName ) ) ; return TRUE ; }
Saves the specified file with the provided file contents.

@param string $FileName The full path and name of the file to be saved.
@param string $FileContents The contents of the file being saved.
Saves the specified file with the provided file contents .