本文整理汇总了PHP中get_filesize函数的典型用法代码示例。如果您正苦于以下问题:PHP get_filesize函数的具体用法?PHP get_filesize怎么用?PHP get_filesize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_filesize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_dir
function list_dir($dir)
{
echo "<TABLE WIDTH=50% BORDER=0><TR><TH>Type</TH><TH>Filename</TH><TH>Size</TH><TH>MD5</TH></TR>";
if (is_dir($dir)) {
$arr = scandir($dir);
foreach ($arr as $item) {
if (is_dir($dir . '/' . $item)) {
if ($item != "." && $item != "..") {
echo "<TR><TD>DIR</TD><TD>{$item}</TD></TR>";
}
} else {
$file = $dir . '/' . $item;
echo "<TR><TD>FILE</TD><TD>{$item}</TD><TD>" . get_filesize(filesize($file)) . "</TD><TD>" . md5_file($file) . "</TD></TR>";
}
}
} else {
return false;
}
echo "</TABLE>";
}
示例2: get_img
function get_img($fn)
{
$size = GetImageSize($fn);
echo '<img src="' . $fn . '" ' . $size[3] . ' ALT="' . basename($fn) . '(' . get_filesize($fn) . ')">';
}
示例3: get_file
function get_file($bo_table, $wr_id)
{
global $g5, $qstr;
$file['count'] = 0;
$sql = " select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' order by bf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result)) {
$no = $row['bf_no'];
$file[$no]['href'] = G5_BBS_URL . "/download.php?bo_table={$bo_table}&wr_id={$wr_id}&no={$no}" . $qstr;
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no]['path'] = G5_DATA_URL . '/file/' . $bo_table;
$file[$no]['size'] = get_filesize($row['bf_filesize']);
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $row['bf_content'];
$file[$no]['content'] = get_text($row['bf_content']);
//$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
$file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
$file[$no]['file'] = $row['bf_file'];
$file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
$file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
$file[$no]['image_type'] = $row['bf_type'];
$file['count']++;
}
return $file;
}
示例4: urlencode
echo "<BR/><BR/><center><table width=300>";
echo "<TR><TD width=44%><img src='images/folder.gif'> <font size=-1 color=#666666>Folder</font></TD>";
echo "<TD width=56%><img src='images/save.png'> <font size=-1 color=#666666>Download File</font></TD></TR>";
}
echo '</TR></table><BR/><BR/>';
if ($mp3count > 2) {
echo "<a href='mp3playlist.php?dir=" . urlencode($dir) . "&symlink=" . urlencode($symlink) . "'>Make a playlist of these MP3s</a><BR/><BR/>";
}
if ($candownload) {
if ($symlink) {
echo "<a href='grabfolder.php?dir=" . htmlentities("{$symbase}&file={$archivename}", ENT_QUOTES) . "'>Grab this folder";
echo " (" . get_filesize($dirdetails[2]) . ")";
echo "</a>";
} else {
echo "<a href='grabfolder.php?dir=" . htmlentities("{$basedir}{$dir}&file={$archivename}", ENT_QUOTES) . "'>Grab this folder";
echo " (" . get_filesize($dirdetails[2]) . ")";
echo "</a>";
}
} else {
if ($reason == 1) {
if ($dirdetails[2] > 900000000) {
echo "<font class=body>Folder is too large for direct download</font>";
echo "<BR/>";
} else {
echo "<font class=body>Folder is too large for direct download</font>";
echo "<BR/>";
}
} else {
echo "<font class=body>Folder contains too many files for direct download</font>";
echo "<BR/>";
}
示例5: apms_get_file
function apms_get_file($dir, $pf_id)
{
global $g5;
if (!$pf_id) {
return;
}
//파일타입 설정
switch ($dir) {
case 'item':
$pf_dir = 1;
$dir = 'item';
$pf_url = G5_SHOP_URL;
$pf_path = G5_DATA_URL . '/item/' . $pf_id;
break;
case 'partner':
$pf_dir = 2;
$dir = 'partner';
$pf_url = G5_ADMIN_URL . '/apms_admin';
$pf_path = G5_DATA_URL . '/apms/' . $dir;
break;
default:
return;
}
$file['count'] = 0;
$file['torrent'] = 0;
$sql = " select * from {$g5['apms_file']} where pf_id = '{$pf_id}' and pf_dir = '{$pf_dir}' order by pf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result)) {
$no = $row['pf_no'];
$file[$no]['id'] = $pf_id;
$file[$no]['href'] = $pf_url . "/download.php?pf_id={$pf_id}&pf={$pf_dir}&no={$no}";
$file[$no]['href_view'] = $pf_url . "/view.php?pf_id={$pf_id}&pf={$pf_dir}&no={$no}";
$file[$no]['path'] = $pf_path;
$file[$no]['guest_use'] = $row['pf_guest_use'];
$file[$no]['purchase_use'] = $row['pf_purchase_use'];
$file[$no]['download'] = $row['pf_download'];
$file[$no]['download_use'] = $row['pf_download_use'];
$file[$no]['view'] = $row['pf_view'];
$file[$no]['view_use'] = $row['pf_view_use'];
$file[$no]['size'] = get_filesize($row['pf_filesize']);
$file[$no]['datetime'] = $row['pf_datetime'];
$file[$no]['source'] = addslashes($row['pf_source']);
$file[$no]['file'] = $row['pf_file'];
$file[$no]['image_width'] = $row['pf_width'] ? $row['pf_width'] : 640;
$file[$no]['image_height'] = $row['pf_height'] ? $row['pf_height'] : 480;
$file[$no]['image_type'] = $row['pf_type'];
$file[$no]['ext'] = $row['pf_ext'];
if ($row['pf_ext'] == "6") {
$file['torrent']++;
}
$file['count']++;
}
return $file;
}
示例6: doBackup
function doBackup($tables, $OutType, $OutDest, $toBackUp, $UserAgent, $local_backup_path, &$databaseResult, $backupname, $excltables = array(), $dbname)
{
global $database, $mosConfig_db, $mosConfig_sitename, $version, $option, $task, $mosConfig_dbprefix, $_CONFIG, $mosConfig_user, $mosConfig_password, $mosConfig_host;
if (!$tables[0]) {
$databaseResult = LM_DATABASE_MISSING_TABLES;
return;
}
addXLog("Exporting database `{$dbname}`");
/* Determine the mime type and file extension for the output file */
if ($OutType == "zip") {
$filename = $backupname . "-sql" . ".zip";
} elseif ($OutType == "html") {
$filename = $backupname . "-sql" . ".html";
} else {
$filename = $backupname . "-sql" . ".sql";
}
$sqlfile = "{$local_backup_path}/{$filename}";
addXLog("SQL file setup to: " . $sqlfile);
@unlink($sqlfile);
/* Store all the tables we want to back-up in variable $tables[] */
if ($tables[0] == "all") {
array_pop($tables);
$query = mysql_query("SHOW tables");
while ($row = mysql_fetch_array($query)) {
$tables_list[] = $row[0];
}
$tables = array_merge($tables, $tables_list);
}
$newtables = array();
//if(is_array($excltables))
foreach ($tables as $key => $value) {
if (is_array($excltables)) {
if (!in_array($value, $excltables)) {
$newtables[] = $value;
}
} else {
$newtables[] = $value;
}
}
addXLog("Exporting tables: ");
addXLog(implode("\n", $newtables));
if (sizeof($tables) == sizeof($newtables)) {
$ex_dump = "";
} else {
$ex_dump = @implode(" ", $newtables);
}
$tables = $newtables;
if ($_REQUEST['dbbackup_drop']) {
$drop = " --add-drop-table";
} else {
$drop = "";
}
if ($_REQUEST['dbbackup_comp']) {
$drop .= " --compatible=" . strtolower($_REQUEST['dbbackup_comp']) . " ";
}
if ($_CONFIG['sql_mem']) {
exec($_CONFIG[sqldump] . " -h " . $_CONFIG['mysql_host'] . " -u " . $_CONFIG['mysql_user'] . " -p" . $_CONFIG['mysql_pass'] . " " . $dbname . " > " . $sqlfile . " {$drop} --allow-keywords " . $ex_dump);
if (get_filesize($sqlfile) > 0) {
$databaseResult = LM_DATABASE_BACKUP_COMPLETED . ' ( ' . getFileSizeText(get_filesize($sqlfile)) . ' )';
} else {
$databaseResult = LM_MSG_BACK_14;
}
exec("chmod 777 {$sqlfile}");
return $sqlfile;
}
/*Added some default values for quotes and auto_increment problems*/
mysql_query("SET SQL_QUOTE_SHOW_CREATE=1;");
mysql_query("SET sql_mode = 0;");
if ($_REQUEST['dbbackup_comp']) {
mysql_query("SET sql_mode=" . $_REQUEST['dbbackup_comp'] . ";");
}
/* Store the "Create Tables" SQL in variable $CreateTable[$tblval] */
if ($toBackUp != "data") {
foreach ($tables as $tblval) {
$query = mysql_query("SHOW CREATE table `{$tblval}`");
$row = mysql_fetch_array($query);
$CreateTable[$tblval] = $row[1];
}
}
/* Store all the FIELD TYPES being backed-up (text fields need to be delimited) in variable $FieldType*/
if ($toBackUp != "structure") {
foreach ($tables as $tblval) {
$query = mysql_query("SHOW FIELDS FROM `{$tblval}`");
while ($row = mysql_fetch_row($query)) {
$fields[] = $row[0];
}
foreach ($fields as $field) {
$FieldType[$tblval][$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
}
}
}
if ($OutDest == "local") {
$fp = fopen($sqlfile, "w");
if (!$fp) {
$databaseResult = LM_DATABASE_BACKUP_FAILED;
return;
}
}
/* Build the fancy header on the dump file */
$OutBuffer = "";
//.........这里部分代码省略.........
示例7: mwexec
$pconfig['do_action'] = false;
$pconfig['action'] = "";
$pconfig['disk'] = "";
$pconfig['oldpassphrase'] = "";
$pconfig['passphrase'] = "";
}
if (isset($_GET['disk'])) {
$pconfig['disk'] = $_GET['disk'];
}
if (isset($_GET['action'])) {
$pconfig['action'] = $_GET['action'];
}
if ("backup" === $pconfig['action']) {
$fn = "/var/tmp/{$geli['name']}.metadata";
mwexec("/sbin/geli backup {$geli['device'][0]} {$fn}");
$fs = get_filesize($fn);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$geli['name']}.metadata");
header("Content-Length: {$fs}");
readfile($fn);
unlink($fn);
exit;
}
if ("restore" === $pconfig['action']) {
if (is_uploaded_file($_FILES['backupfile']['tmp_name'])) {
$fn = "/var/tmp/{$geli['name']}.metadata";
// Move the metadata backup file so PHP won't delete it.
move_uploaded_file($_FILES['backupfile']['tmp_name'], $fn);
} else {
$errormsg = sprintf("%s %s", gettext("Failed to upload file."), $g_file_upload_error[$_FILES['backupfile']['error']]);
}
示例8: getBackupFiles
function getBackupFiles(&$d_arr, &$f_arr, &$s_arr, &$d, &$f)
{
// ----------------------------------------------------------
// Routine to list the existing backup files in the Component
// Backup folder
// ----------------------------------------------------------
global $_CONFIG;
$path = $_CONFIG['clonerPath'];
# Open possibly available directory
if (is_dir($path)) {
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
# Make sure we don't push parental directories or dotfiles (unix) into the arrays
if ($file != "." && $file != ".." && $file[0] != ".") {
if (is_dir($path . "/" . $file)) {
# Create array for directories
$d_arr[$d++] = $file;
} else {
if (strstr($file, '.zip') || strstr($file, '.tgz') || strstr($file, '.tar')) {
# Create array for files
$f_arr[$f++] = $file;
}
}
}
}
}
}
# Wrap things up if we're in a directory
if (is_dir($path)) {
closedir($handle);
}
sort($f_arr);
# Print file list
for ($i = 0; $i < count($f_arr); $i++) {
$s_arr[$i] = getFileSizeText(get_filesize($path . "/" . $f_arr[$i]));
}
}
示例9: htmlentities
echo '<B>' . htmlentities(str_replace('.', ' ', basename(substr($filename, 0, strrpos($filename, '.'))))) . '</B><BR/>';
echo '<BR/>';
echo $percent . '%<BR/>';
echo 'Estimated data usage : ' . $totalsize . '<BR/>';
echo '<BR/>';
echo '<A HREF="/3gp/wait.php?ticket=' . $ticket . '&refresh=' . $refresh . '">Refresh</A><BR/>';
echo '<BR/>';
echo '<A HREF="/Browser">Back to the Browser</a>';
echo '</center>';
}
}
if ($keyed) {
echo '<CENTER><BR/>';
echo '<B>' . htmlentities(str_replace('.', ' ', basename(substr($filename, 0, strrpos($filename, '.'))))) . '<BR/></B>Is Ready!';
echo '<BR/><BR/><BR/>';
echo 'Total Size : ' . get_filesize(filesize($tmpfolder . '/publish/' . $ticket . '.3gp'));
echo '<BR/><BR/><A HREF="rtsp://cerberus.viper-7.com/' . $ticket . '.3gp">Watch Now</A><BR/>';
echo '<BR/>';
echo '<A HREF="/Browser">Back to the Browser</a></CENTER><BR/>';
}
}
}
?>
</TD>
</TR>
</TABLE>
</td>
<td width=15 background='images/right.jpg'></td>
</tr>
</table>
</td>
示例10: get_filesize
return;
}
var objTbl;
var objRow;
var objCell;
if (document.getElementById)
objTbl = document.getElementById("variableFiles");
else
objTbl = document.all["variableFiles"];
objRow = objTbl.insertRow(objTbl.rows.length);
objCell = objRow.insertCell(0);
objCell.innerHTML = "<input type='file' id=bf_file_" + flen + " name='bf_file[]' title='파일 용량 <?php
echo get_filesize($board[bo_upload_size]);
?>
이하만 업로드 가능' <?php
if ($mw_basic['cf_guploader']) {
echo "multiple";
}
?>
>";
/*
str = "<input type='file' id=bf_file_" + flen + " name='bf_file[]' title='파일 용량 <?php
echo $upload_max_filesize;
?>
이하만 업로드 가능' class=mw_basic_text> ";
str+= " <input type='button' value='본문에 넣기' onclick=\"document.getElementById('wr_content').value += '{이미지:" + flen + "}'\"";
objCell.innerHTML = str;
示例11: unset
unset($errormsg);
if (0 == strcmp($_POST['Submit'], gettext("Restore configuration"))) {
$mode = "restore";
} else {
if (0 == strcmp($_POST['Submit'], gettext("Download configuration"))) {
$mode = "download";
}
}
if ($mode) {
if ($mode === "download") {
config_lock();
if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
@date_default_timezone_set(@date_default_timezone_get());
}
$fn = "config-{$config['system']['hostname']}.{$config['system']['domain']}-" . date("YmdHis") . ".xml";
$fs = get_filesize("{$g['conf_path']}/config.xml");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$fn}");
header("Content-Length: {$fs}");
header("Pragma: hack");
readfile("{$g['conf_path']}/config.xml");
config_unlock();
exit;
} else {
if ($mode === "restore") {
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
// Validate configuration backup
if (!validate_xml_config($_FILES['conffile']['tmp_name'], $g['xml_rootobj'])) {
$errormsg = sprintf(gettext("The configuration could not be restored. %s"), gettext("Invalid file format."));
} else {
// Install configuration backup
示例12: validate_doc_files
function validate_doc_files(&$h)
{
global $glob;
$badfiles = array();
foreach (preg_split("/,\\s*/", $h['doc_files']) as $file) {
if ($file) {
$path = $glob['image_src_path'] . "/" . $file;
if (file_exists($path)) {
$size = get_filesize($path);
if ($size <= 0) {
$badfiles[] = "'" . $file . "'";
}
} else {
$badfiles[] = "'" . $file . "'";
}
}
}
if (count($badfiles) > 0) {
$h['doc_files_error_message'] = "can't read doc_file(s): " . join(",", $badfiles);
return false;
}
return true;
}
示例13: append_enclosure
protected function append_enclosure($url)
{
if (!($size = get_filesize($url))) {
$size = "unknown";
}
// $size = 1000;
switch (strtolower(pathinfo($url, PATHINFO_EXTENSION))) {
case "jpg":
case "jpeg":
$type = "image/jpeg";
break;
case "gif":
$type = "image/gif";
break;
case "png":
$type = "image/png";
break;
case "mpeg":
case "mpg":
case "mpe":
$type = "video/mpeg";
break;
case "avi":
$type = "video/x-msvideo";
break;
case "mov":
case "qt":
$type = "video/quicktime";
break;
case "tif":
case "tiff":
$type = "image/tiff";
break;
case "bmp":
$type = "image/bmp";
break;
case "ppt":
case "pps":
$type = "application/powerpoint";
break;
case "pdf":
$type = "application/pdf";
break;
case "xls":
$type = "application/excel";
break;
case "zip":
$type = "application/zip";
break;
case "doc":
$type = "application/msword";
break;
case "mp3":
$type = "audio/mpeg3";
break;
case "ogg":
$type = "audio/ogg";
break;
case "wma":
$type = "audio/x-ms-wma";
break;
default:
//no valid mime type found
return FALSE;
}
return array('url' => $url, 'size' => $size, 'type' => $type);
}
示例14: get_safe_filename
@fwrite($f, "");
@fclose($f);
@chmod($indexfile, 0606);
$file = $_FILES['comment_image'];
$file['name'] = get_safe_filename($file['name']);
$size = @getImageSize($file['tmp_name']);
$mime = array('image/png', 'image/jpeg', 'image/gif');
$exts = array('png', 'jpg', 'gif');
if ($size[0] > $cf_x) {
alert("가로사이즈가 {$cf_x}px 보다 큽니다.");
}
if ($size[1] > $cf_y) {
alert("세로사이즈가 {$cf_y}px 보다 큽니다.");
}
if ($file['size'] > $cf_size) {
alert("파일용량이 " . get_filesize($cf_size) . " 보다 큽니다.");
}
$ext = substr($file['name'], strlen($file['name']) - 3, 3);
if ($image_del) {
@unlink($dest_file);
}
if (is_uploaded_file($file['tmp_name'])) {
if (!in_array($size['mime'], $mime)) {
alert_close("PNG, GIF, JPG 형식의 이미지 파일만 업로드 가능합니다.");
}
if (!in_array($ext, $exts)) {
alert_close("PNG, GIF, JPG 형식의 이미지 파일만 업로드 가능합니다.");
}
if (!is_dir($path)) {
alert_close("{$path} 디렉토리가 존재하지 않습니다.");
}
示例15: output
function output($dir, $list)
{
$wf = new Workflows();
$parent = dirname($dir);
if ($dir != '/') {
$icon_name = $parent == '/' ? 'HomeFolderIcon.icns' : 'BackwardArrowIcon.icns';
$wf->result(0, $parent . ($parent == '/' ? '' : '/'), ".. ({$parent})", "Goto parent directory", $GLOBALS["icon_path"] . $icon_name);
}
foreach ($list as $index => $entry) {
$info = pathinfo($entry['name']);
$path = (substr($dir, -1) == '/' ? $dir : "{$dir}/") . $entry["name"];
// TODO: need to optimize performance in loop
if ($entry["flag"] == 'd') {
$path = "{$path}/";
$icon = $GLOBALS["icon_path"] . (getCachedItem($path) ? 'DropFolderIcon.icns' : 'GenericFolderIcon.icns');
} else {
$icon = array_key_exists('extension', $info) ? "filetype:." . $info['extension'] : $GLOBALS["icon_path"] . 'GenericDocumentIcon.icns';
}
$wf->result($index + 1, $path, $entry["name"], ($entry["flag"] == '-' ? get_filesize($entry["size"]) . '. ' : '') . "Last modified: " . $entry["lastmodifieddate"], $icon, $entry["flag"] == '-');
}
echo $wf->toxml();
}