/** * Move os arquivos do diretório temporário para o diretório correto. * Importante que na chamada ela precisa final depois de todos os addFile * e fora de qualquer if. */ public function move() { foreach ($this->_files as $file) { Folder::delete(dirname($file['destiny'])); Folder::make_writable(dirname($file['destiny'])); rename($file['origin'], $file['destiny']); } }
public function save($folder_path) { $this->generate(); Folder::make_writable($folder_path); $objWriter = PHPExcel_IOFactory::createWriter($this->_phpexcel, 'Excel2007'); $objWriter->save($folder_path . $this->_file_name . '.xlsx'); return $this->_file_name . '.xlsx'; }
public function setPath($path) { try { Folder::make_writable($path); $this->path = $path; } catch (\Exception $e) { throw new \InvalidArgumentException('Caminho de destino inválido'); } }
protected function deleteUploadFolder($field) { if (array_key_exists("{$field}_delete", $this->_input)) { if ($this->getValue("{$field}_delete")) { Folder::delete($this->_path); $this->_table->{$field} = null; } } }
/** * Move os arquivos do diretório temporário para o diretório correto. * Importante que na chamada ela precisa final depois de todos os addFile * e fora de qualquer if. */ public function copy() { foreach ($this->_files as $index => $file) { Folder::delete(dirname($file['destiny'])); Folder::make_writable($file['destiny']); $path_parts = pathinfo($file['origin']); $basename = urldecode($path_parts['basename']); copy($path_parts['dirname'] . '/' . $basename, $file['destiny'] . $basename); $this->_files[$index]['final'] = str_replace('public', '', $file['destiny'] . $basename); } }
public function batch_delete_all($id_photo) { $arr_criteria = array("{$this->_id_photo} = ?" => $id_photo); Folder::delete("public/system/uploads/{$this->_photo}/{$id_photo}/{$this->_photo_item}/"); $this->_dao->delete($this->_photo_item, $arr_criteria); }
public function delete($itens) { foreach ($itens as $item) { $id = $this->_entity->getId(); $tbl = $this->_entity->getTbl(); $title = $this->_entity->getTitle(); $entity_sequence = $this->_entity->getSequence(); if (count($entity_sequence)) { $seq = new SequenceModel(); $seq->changeSequence(array('tbl' => $tbl, 'id' => $item['id'], 'sequence' => 0)); } $tableHistory = $this->getById($item['id']); $this->beforeDelete($tableHistory); $this->deleteChildren($this->_entity, $item['id']); Folder::delete("public/system/uploads/{$tbl}/{$item['id']}"); $this->_dao->delete($tbl, array($id . ' = ?' => $item['id'])); if (isset($title)) { $this->log('D', $tableHistory[$title], $this->_table, $tableHistory); } } }
public function save($path) { $diretorio = dirname($path); Folder::make_writable($diretorio); if (strrpos($path, DIRECTORY_SEPARATOR) == strlen($path) - 1) { $path .= basename($this->_path); } $opt = array('jpeg_quality' => 100, 'png_compression_level' => 9); $this->_resizeImage->save($path, $opt); return $path; }
public function testeSetPath() { $this->simpleUpload->setPath(__DIR__ . '/files'); $test = $this->simpleUpload->getPath(); $this->assertEquals(__DIR__ . '/files', $test); Folder::delete(__DIR__ . '/files'); }