/** * Upload by base64 encoded source * * @param ImageInterface $image Image entity * @param string $content Base64 source * @param array $options Upload options * * @return ImageInterface */ public function uploadBase64(ImageInterface $image, $content, array $options = []) { $this->tmpFile->create()->write(base64_decode($content)); try { $image = $this->upload($image, $this->tmpFile->getPath(), $options); } finally { $this->tmpFile->clear(); } return $image; }
public function testClear() { $files = array('test1', 'test2'); $_files = array(); foreach ($files as $file) { $_files[] = TempFile::fileName($file); } TempFile::clear(); foreach ($_files as $file) { $this->assertFalse(file_exists($file)); } }
/** * Called when the main loop exits * @return void */ public function cleanUp() { TempFile::clear(); }