Pop\File\File::save PHP Method

save() public method

Save the file object to disk.
public save ( string $to = null, boolean $append = false ) : File
$to string
$append boolean
return File
    public function save($to = null, $append = false)
    {
        $file = null === $to ? $this->fullpath : $to;
        if ($append) {
            file_put_contents($file, $this->read(), FILE_APPEND);
        } else {
            file_put_contents($file, $this->read());
        }
        $this->setFile($this->fullpath, $this->allowed);
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Save the PDF directly to the server.
  *
  * @param  string  $to
  * @param  boolean $append
  * @throws Exception
  * @return \Pop\Pdf\Pdf
  */
 public function save($to = null, $append = false)
 {
     // Format and finalize the PDF.
     $this->finalize();
     parent::save($to, $append);
     return $this;
 }
All Usage Examples Of Pop\File\File::save