protected function uploadAttachedFiles() { foreach ($this->_attached_files as $field => $file) { $_file = File::create(array('file' => $file)); $this->setAttribute($field, $_file->path); $this->setAttribute($field . '_id', $_file->_id); } $this->_attached_files = null; }
public function testStore() { $file = File::create(array('file' => 'data:text/plain;base64,' . base64_encode('Saving text file.'))); $this->assertTrue(preg_match('/^http:\\/\\//', $file->path) == 1); $this->assertTrue($file->read() == "Saving text file."); }