/** * Root * * @access public * @return Response */ public function action_index() { $data = array('dirs' => array()); try { /** * get documentation list */ $dirs = array_keys(File::read_dir(DOCROOT . 'dbdocs' . DS, 1)); foreach ($dirs as $dir) { $i = count($data['dirs']); $data['dirs'][$i]['name'] = rtrim($dir, DS) . '/'; $file_info = File::file_info(DOCROOT . 'dbdocs' . DS . $dir); $data['dirs'][$i]['time_ago'] = Date::time_ago($file_info['time_created']); } } catch (Fuel\Core\InvalidPathException $e) { //do nothing } $this->template->content = View::forge('index/index', array('data' => $data)); }
public function check_real_file_tmp_info($file_path) { $file_info = File::file_info($file_path); $file_name = $file_info['basename']; $file = Model_FileTmp::get4name($file_name); // file に対応する Model_File が存在する $this->assertNotEmpty($file); $is_thumbnail = Util_file::get_path_partial($file_info['dirname'], 1) == 'thumbnail'; // path の確認 $length = $is_thumbnail ? 3 : 2; $offset = $is_thumbnail ? 1 : 0; $this->assertEquals(trim($file->path, '/'), Util_file::get_path_partial($file_info['dirname'], $length, $offset)); // type の確認 if ($file_info['mimetype'] != 'application/zip') { $this->assertEquals($file->type, $file_info['mimetype']); } // size の確認 if (!$is_thumbnail) { $this->assertEquals($file->filesize, $file_info['size']); } }
private function set_file_properties($file_path) { $ext = Util_file::get_image_type($file_path); $file_info = File::file_info($file_path); $this->file->size = $file_info['size']; $this->file->type = $file_info['mimetype']; if (empty($this->file->original_name)) { $this->file->original_name = $file_info['filename']; } if (!($this->file->name = \Site_Upload::make_unique_filename($ext, $this->options['filename_prefix'], $this->file->original_name, $this->options['upload_dir']))) { throw new FuelException('File already exists.'); } $this->file->file_path = $this->options['upload_dir'] . str_replace($this->options['filename_prefix'], '', $this->file->name); }