当前位置: 首页>>代码示例>>PHP>>正文


PHP file::size方法代码示例

本文整理汇总了PHP中file::size方法的典型用法代码示例。如果您正苦于以下问题:PHP file::size方法的具体用法?PHP file::size怎么用?PHP file::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在file的用法示例。


在下文中一共展示了file::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: afterInit

 protected function afterInit()
 {
     $this->dir = $this->cfg->dir;
     if ($this->cfg->subdir) {
         $this->subdir = $this->cfg->subdir . DS;
         $this->dir .= $this->subdir;
     }
     file::createDir($this->dir);
     $uploaded = false;
     if (strpos($this->cfg->name, '[')) {
         $tmp = explode('[', str_replace(']', '', $this->cfg->name));
         $tmpfile = utils::getValInArray($_FILES, $tmp);
         if (!empty($tmpfile) && is_array($tmpfile)) {
             $this->file = $tmpfile;
             $this->file['saved'] = false;
             $uploaded = $this->file['error'] == UPLOAD_ERR_OK;
         }
     } else {
         if (array_key_exists($this->cfg->name, $_FILES)) {
             $this->file = $_FILES[$this->cfg->name];
             $this->file['saved'] = false;
             $uploaded = $this->file['error'] == UPLOAD_ERR_OK;
         }
     }
     if ($this->cfg->current && !$uploaded) {
         $name = basename($this->cfg->current);
         $savePath = $this->dir . $name;
         $webPath = str_replace(DS, '/', $this->subdir . $name);
         $this->file = array('name' => $name, 'type' => file::getType($savePath), 'tmp_name' => '', 'error' => UPLOAD_ERR_OK, 'size' => file::size($savePath), 'saved' => array('name' => $name, 'savePath' => $savePath, 'webPath' => $webPath), 'savedFromValue' => true);
         $this->saved = $webPath;
     }
     $this->helper = factory::isCreable('helper_' . $this->cfg->helper) ? factory::getHelper($this->cfg->helper, $this->getHelperPrm('factory')) : null;
     if ($this->cfg->autoSave && !empty($this->file) && $this->isValid() === true) {
         $this->save();
     }
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:36,代码来源:fileUploaded.class.php

示例2: showFile

	/**
	 * Show a file to the client
	 *
	 * @param string $file File Path
	 */
	public function showFile($file) {
		if (file::exists($file)) {
			$type = file::getType($file);
			if (strpos($type, 'audio') === 0 || strpos($type, 'video') === 0) {
				$this->mediaDownload($file);
			} else {
				$this->cfg->compress = false;
				$this->neverExpire();
				$this->addHeader('Last-Modified', gmdate('D, j M Y H:i:s', filemtime($file)).' GMT', true);
				$this->addHeader('Content-Type', $type, true);
				$this->addHeader('Cache-Control', 'public', false);
				$this->addHeader('Pragma', null, false);
				$this->addHeader('Content-length', file::size($file), true);
				$this->sendText(file::read($file));
			}
		}
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:22,代码来源:http.class.php

示例3: foreach

"><?php 
    echo $folder;
    ?>
</a></td>
	<td></td>
	<td></td>
	<td></td>
	<td></td>
	<td></td>
</tr>
<?php 
}
foreach ($files as $file) {
    $filepath = site::template($dir . '/' . $file);
    $filedata = file::data($filepath);
    $filesize = file::size($filepath, true);
    ?>
<tr class="item file">
	<td class="w20 center"><span class="zotop-icon zotop-icon-file"></span></td>
	<td class="w120"><input type="hidden" value="<?php 
    echo empty($dir) ? $file : $dir . '/' . $file;
    ?>
"/><?php 
    echo $file;
    ?>
</td>
	<td><?php 
    echo $filedata['description'] ? $filedata['description'] : $filedata['title'];
    ?>
</td>
	<td class="w60"><?php 
开发者ID:dalinhuang,项目名称:zotop,代码行数:31,代码来源:select.php


注:本文中的file::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。