You are here

private function UploadedFile::writeFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/UploadedFile.php \Zend\Diactoros\UploadedFile::writeFile()

Write internal stream to given path

Parameters

string $path:

1 call to UploadedFile::writeFile()
UploadedFile::moveTo in vendor/zendframework/zend-diactoros/src/UploadedFile.php

File

vendor/zendframework/zend-diactoros/src/UploadedFile.php, line 219

Class

UploadedFile

Namespace

Zend\Diactoros

Code

private function writeFile($path) {
  $handle = fopen($path, 'wb+');
  if (false === $handle) {
    throw new RuntimeException('Unable to write to designated path');
  }
  $stream = $this
    ->getStream();
  $stream
    ->rewind();
  while (!$stream
    ->eof()) {
    fwrite($handle, $stream
      ->read(4096));
  }
  fclose($handle);
}