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


PHP getFileType函数代码示例

本文整理汇总了PHP中getFileType函数的典型用法代码示例。如果您正苦于以下问题:PHP getFileType函数的具体用法?PHP getFileType怎么用?PHP getFileType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: listFile

function listFile($path)
{
    global $config;
    $filetype = getFileType($path);
    if ($filetype == 'text') {
        $text = file_get_contents($config['files'] . $path);
    } else {
        if ($filetype == 'opendocument.text') {
            require "ophir.php";
            $OPHIR_CONF["header"] = 1;
            $OPHIR_CONF["quote"] = 1;
            $OPHIR_CONF["list"] = 1;
            $OPHIR_CONF["table"] = 1;
            $OPHIR_CONF["footnote"] = 1;
            $OPHIR_CONF["link"] = 1;
            $OPHIR_CONF["image"] = 1;
            $OPHIR_CONF["note"] = 1;
            $OPHIR_CONF["annotation"] = 1;
            $text = odt2html($config['files'] . $path);
        } else {
            $text = '';
        }
    }
    return array('type' => 'file', 'filetype' => $filetype, 'mimetype' => system_extension_mime_type($path), 'name' => basename($path), 'path' => $path, 'text' => $text);
}
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:25,代码来源:list.php

示例2: display_company_image_from_string

function display_company_image_from_string($company_name, $row_number, $extra = "")
{
    $data = json_decode(query_an_image($company_name . " " . $extra));
    $img_urls = array();
    $img_names = array();
    foreach ($data->responseData->results as $result) {
        $img_urls[] = $result->url;
        $img_names[] = "/var/www/html/parse-data-dot-com/images/{$row_number}";
        $results[] = array('url' => $result->url, 'alt' => $result->title);
        $url = $result->url;
        $ftype = getFileType($url);
        #echo $ftype;
        $img = "/var/www/html/parse-data-dot-com/images/{$row_number}.{$ftype}";
        echo $url;
        #echo $img;
        if (strpos($url, "https") < 0) {
            //using asfiletype=png
            continue 2;
        } else {
            try {
                return $url;
            } catch (Exception $e) {
                echo "Caught exceptiom : {$e}";
                continue;
            }
        }
    }
    #var_dump($url);
    #var_dump($img);
    return $data;
}
开发者ID:juliusakula,项目名称:clients-ktc,代码行数:31,代码来源:CURLQuery.php

示例3: _initialize

 /**
  * Initialize the upload class
  * @param string $upload The key value of the $_FILES superglobal to use
  */
 private function _initialize($upload)
 {
     $this->_uploadedFile = $upload['name'];
     $this->_tempName = $upload['tmp_name'];
     $this->_fileSize = $upload['size'];
     $this->_extension = getFileExtension($this->_uploadedFile);
     $this->_mimeType = getFileType($this->_tempName);
 }
开发者ID:ITESolutions,项目名称:desktop,代码行数:12,代码来源:Upload.php

示例4: handleUpload

/**
 * Handle and read uploaded file
 * @param array - fileArray from form
 * @param array - postArray from form
 */
function handleUpload($_FILES, $_POST)
{
    require_once "JotForm.php";
    $path = mktime() . '_' . $_FILES['file']['name'];
    $key = $_POST['APIkey'];
    $form = $_POST['formID'];
    $jot = new JotForm($key);
    $error = "";
    if (move_uploaded_file($_FILES['file']['tmp_name'], $path)) {
        $fileType = getFileType($path);
        $columns = array();
        if ($fileType == 'csv') {
            if (($handle = fopen($path, "r")) !== FALSE) {
                if (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                    foreach ($data as $title) {
                        array_push($columns, $title);
                    }
                }
                $error = 'File must contain at least two rows - the first represents the field titles';
                while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                    $error = '';
                    $result = $jot->createFormSubmissions($form, writeData($data, $columns));
                }
                fclose($handle);
            } else {
                $error = 'Could not open file';
            }
        } else {
            require_once 'Excel/reader.php';
            $excel = new Spreadsheet_Excel_Reader();
            $excel->read($path);
            if ($excel->sheets[0]['numRows'] > 1) {
                for ($i = 1; $i <= $excel->sheets[0]['numCols']; $i++) {
                    $title = $excel->sheets[0]['cells'][1][$i];
                    array_push($columns, $title);
                }
                for ($i = 2; $i <= $excel->sheets[0]['numRows']; $i++) {
                    $data = array();
                    for ($j = 1; $j <= $excel->sheets[0]['numCols']; $j++) {
                        array_push($data, $excel->sheets[0]['cells'][$i][$j]);
                    }
                    $jot->createFormSubmissions($form, writeData($data, $columns));
                }
            } else {
                $error = 'File must contain at least two rows - the first represents the field titles';
            }
        }
    } else {
        $error = 'No File Found';
    }
    if (strlen($error) > 0) {
        return $error;
    } else {
        return 'none';
    }
}
开发者ID:abmedia,项目名称:api-use-cases,代码行数:61,代码来源:import.php

示例5: generate_name

function generate_name($data)
{
    $fileType = getFileType($data);
    $base = "temp";
    if (isset($_POST["guid"])) {
        $base = $_POST["guid"];
    }
    $date = new DateTime();
    $timestamp = $date->getTimestamp();
    return $base . "-" . $timestamp . $fileType;
}
开发者ID:shadowbeam,项目名称:img-srch,代码行数:11,代码来源:file-upload.php

示例6: get_company_image_from_string

function get_company_image_from_string($company_name, $row_number, $extra = "")
{
    $data = json_decode(query_an_image($company_name . $extra));
    var_dump($data);
    $img_urls = array();
    $img_names = array();
    foreach ($data->responseData->results as $result) {
        $img_urls[] = $result->url;
        $img_names[] = "C:/git-lyris/parse-data-dot-com/images/{$row_number}";
        $results[] = array('url' => $result->url, 'alt' => $result->title);
        $url = $result->url;
        $ftype = getFileType($url);
        #echo $ftype;
        $img = "C:/git-lyris/parse-data-dot-com/images/{$row_number}.{$ftype}";
        echo $url;
        #echo $img;
        if (strpos($url, "https") < 0) {
            //using asfiletype=png
            continue 2;
        } else {
            try {
                echo "<-downloading..\n";
                if (file_put_contents($img, file_get_contents($url))) {
                    break;
                } else {
                    echo "notif file put??";
                    continue;
                }
            } catch (Exception $e) {
                echo "Caught exceptiom : {$e}";
                continue;
            }
        }
    }
    #var_dump($url);
    #var_dump($img);
    return $data;
}
开发者ID:juliusakula,项目名称:clients-ktc,代码行数:38,代码来源:CURLQuery.php

示例7: chkFile


//.........这里部分代码省略.........
                case 4:
                    break;
                case 'UPLOAD_ERR_INI_SIZE':
                case 1:
                    __error("[{$tmp_filename}] 파일 용량이 " . ini_get("upload_max_filesize") . "를 초과할 수 없습니다.\\n(php.ini, upload_max_filesize 설정에서 변경가능)");
                case 'UPLOAD_ERR_FORM_SIZE':
                case 2:
                    __error("[{$tmp_filename}] 파일 용량이 초과 되었습니다.\\n(해당 Form 의 MAX_FILE_SIZE 설정에서 변경 가능합니다)");
                case 'UPLOAD_ERR_PARTIAL':
                case 3:
                    __error("[{$tmp_filename}] 업로드된 파일이 올바르지 않습니다");
                case 'UPLOAD_ERR_NO_TMP_DIR':
                case 6:
                    __error("임시 폴더가 없어 파일을 업로드 할 수 없습니다. 서버 관리자에게 문의해 주세요.\\n(설정된 임시 폴더는 " . ini_get("upload_tmp_dir") . " 입니다)");
                case 'UPLOAD_ERR_CANT_WRITE':
                case 7:
                    __error("디스크에 쓰기를 실패 했습니다. 서버 관리자에게 문의해 주세요");
            }
        }
        //// 파일명 체크
        if ($param['filename']) {
            $filename = $param['filename'];
        }
        $filename = str_replace(array("|", "'", "\"", "\\"), "", $filename);
        $filename = trim($filename);
        //// 확장자 체크
        $val['ext'] = strtolower(substr(strrchr($filename, "."), 1));
        //// 이미지 관련 체크
        $is_image = getimagesize($val['tmp_name']);
        if (!empty($is_image) && is_array($is_image)) {
            $val['is_image'] = 1;
            $val['width'] = $is_image[0];
            $val['height'] = $is_image[1];
        } else {
            $val['is_image'] = 0;
        }
        //// 파일타입
        $val['type'] = getFileType($val['ext']);
        if ($val['type'] == 'image' && empty($val['is_image'])) {
            __error("[{$tmp_filename}] 이미지 파일이 아닙니다");
        }
        if (!$val['is_image'] && $param['is_image']) {
            __error("[{$tmp_filename}] 이미지 파일만 허용합니다");
        }
        if ($val['is_image']) {
            if ($param['width'] && $param['width'] < $val['width']) {
                __error("[{$tmp_filename}] 이미지 너비가 {$param['width']}px 를 초과 했습니다. (현재 {$val['width']}px)");
            }
            if ($param['height'] && $param['height'] < $val['height']) {
                __error("[{$tmp_filename}] 이미지 높이가 {$param['height']}px 를 초과 했습니다. (현재 {$val['height']}px)");
            }
        }
        //// 한글제거
        if (strCut($filename, 0, 'multi')) {
            $filename = urlencode($filename);
        }
        //// 기호제거
        $filename = preg_replace("/[^0-9a-z_\\-\\.]/i", "", $filename);
        //// 파일명 변경
        if ($param['is_download']) {
            $filename = str_replace(".", "_", $filename);
            $filename .= ".mb";
        }
        //// 중복 체크
        if (file_exists($param['dir'] . $filename) && !$param['is_overwrite']) {
            if ($param['is_exists']) {
                __error("[{$tmp_filename}] 중복된 파일명입니다.");
            }
            $a = 0;
            $tmp2_filename = $filename;
            while (file_exists($param['dir'] . $tmp2_filename)) {
                $a++;
                if (strpos($filename, ".") !== false) {
                    $tmp2_filename = preg_replace("/(\\.?[^\\.]+)\$/is", $a . "\\1", $filename);
                } else {
                    $tmp2_filename = $filename . $a;
                }
            }
            $filename = $tmp2_filename;
        }
        //// 내용 중복
        if (!empty($val['size']) && !empty($mini['board']['use_file_unique']) && !empty($mini['board']['no'])) {
            if (sql("SELECT COUNT(*) FROM {$mini['name']['file']} WHERE id={$mini['board']['no']} and hash='" . str(getHash($val), 'encode', 1) . "'")) {
                __error("[{$tmp_filename}] 이미 같은 파일이 있습니다");
            }
        }
        //// 용량 체크
        if ($param['size'] && $param['size'] < $val['size']) {
            __error("[{$tmp_filename}] 파일 용량이 " . number_format($param['size']) . " bytes를 초과할 수 없습니다\\n(현재 {$val['size']}bytes)");
        }
        if ($val['size'] <= 0) {
            __error("[{$tmp_filename}] 파일 용량은 0 byte 이상이어야 합니다");
        }
        //// 변수 입력
        $val['path'] = $param['dir'] . $filename;
        $val['path_only'] = $param['dir'];
        $val['name_insert'] = $filename;
        $_FILES[$key] = $val;
    }
}
开发者ID:bluecat,项目名称:iiwork-php,代码行数:101,代码来源:ii.write.php

示例8: checkFileExists

function checkFileExists($type, $file_name, $folder_path)
{
    $ftp_rawlist = getFtpRawList($folder_path);
    if (is_array($ftp_rawlist)) {
        $fileNameAr = array();
        $count = 0;
        // Go through array of files/folders
        foreach ($ftp_rawlist as $ff) {
            $count++;
            // Lin
            if ($_SESSION["win_lin"] == "lin") {
                // Split up array into values
                $ff = preg_split("/[\\s]+/", $ff, 9);
                $perms = $ff[0];
                $file = $ff[8];
                if ($file != "." && $file != "..") {
                    if ($type == "f" && getFileType($perms) == "f") {
                        $fileNameAr[] = $file;
                    }
                    if ($type == "d" && getFileType($perms) == "d") {
                        $fileNameAr[] = $file;
                    }
                }
            }
            // Mac
            if ($_SESSION["win_lin"] == "mac") {
                if ($count == 1) {
                    continue;
                }
                // Split up array into values
                $ff = preg_split("/[\\s]+/", $ff, 9);
                $perms = $ff[0];
                $file = $ff[8];
                if ($file != "." && $file != "..") {
                    if ($type == "f" && getFileType($perms) == "f") {
                        $fileNameAr[] = $file;
                    }
                    if ($type == "d" && getFileType($perms) == "d") {
                        $fileNameAr[] = $file;
                    }
                }
            }
            // Win
            if ($_SESSION["win_lin"] == "win") {
                // Split up array into values
                $ff = preg_split("/[\\s]+/", $ff, 4);
                $size = $ff[2];
                $file = $ff[3];
                if ($size == "<DIR>") {
                    $size = "d";
                }
                if ($type == "d" && $size == "d") {
                    $fileNameAr[] = $file;
                }
                if ($type == "f" && $size != "d") {
                    $fileNameAr[] = $file;
                }
            }
        }
        // Check if file is in array
        if (in_array($file_name, $fileNameAr)) {
            return 1;
        }
    } else {
        return 0;
    }
}
开发者ID:joyeop,项目名称:Monsta-FTP,代码行数:67,代码来源:index.php

示例9: imgupload

 function imgupload()
 {
     //首先获取上传的总文件数目!
     $imgcount = count($_FILES["files"]["name"]);
     //定义返回的数组
     $backArr = array();
     //根据数量逐个遍历文件
     for ($i = 0; $i <= $imgcount - 1; $i++) {
         $msg = "";
         if ($_FILES['files']['error'][$i] != UPLOAD_ERR_OK) {
             switch ($_FILES['files']['error']) {
                 case UPLOAD_ERR_INI_SIZE:
                     //其值为 1,上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值
                     $msg = "文件超大!错误代码1";
                     break;
                 case UPLOAD_ERR_FORM_SIZE:
                     //其值为 2,上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值
                     $msg = "文件超大!错误代码2";
                     break;
                 case UPLOAD_ERR_PARTIAL:
                     //其值为 3,文件只有部分被上传
                     $msg = "文件未上传完毕!错误代码3";
                     break;
                 case UPLOAD_ERR_NO_FILE:
                     //其值为 4,没有文件被上传
                     $msg = "没有文件被上传!请检查!错误代码4";
                     break;
                 case UPLOAD_ERR_NO_TMP_DIR:
                     //其值为 6,找不到临时文件夹
                     $msg = "服务端错误!未找到临时文件夹!错误代码5";
                     break;
                 case UPLOAD_ERR_CANT_WRITE:
                     //其值为 7,文件写入失败
                     $msg = "文件写入失败!错误代码6";
                     break;
                 case UPLOAD_ERR_EXTENSION:
                     //其他异常
                     $msg = "未知错误!请联系软件人员!错误代码7";
                     break;
             }
         }
         if ($msg == "") {
             //图片正常接收 将文件发送到文件夹并且改名
             /*getimagesize方法返回一个数组,
               $width : 索引 0 包含图像宽度的像素值,
               $height : 索引 1 包含图像高度的像素值,
               $type : 索引 2 是图像类型的标记:
               1 = GIF,2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP,
               7 = TIFF(intel byte order),8 = TIFF(motorola byte order),
               9 = JPC,10 = JP2,11 = JPX,12 = JB2,13 = SWC,14 = IFF,15 = WBMP,16 = XBM,
               $attr : 索引 3 是文本字符串,内容为“height="yyy" width="xxx"”,可直接用于 IMG 标记
               */
             list($width, $height, $type, $attr) = getimagesize($_FILES['files']['tmp_name'][$i]);
             //imagecreatefromgXXX方法从一个url路径中创建一个新的图片
             switch ($type) {
                 case IMAGETYPE_GIF:
                     $image = imagecreatefromgif($_FILES['files']['tmp_name'][$i]);
                     $ext = '.gif';
                     break;
                 case IMAGETYPE_JPEG:
                     $image = imagecreatefromjpeg($_FILES['files']['tmp_name'][$i]);
                     $ext = '.jpg';
                     break;
                 case IMAGETYPE_PNG:
                     $image = imagecreatefrompng($_FILES['files']['tmp_name'][$i]);
                     $ext = '.png';
                     break;
                 default:
                     $msg = "所发送的文件并非为需要接收的格式!请检查!错误代码8!";
             }
             //有url指定的图片创建图片并保存到指定目录
             $imagename = uniqid() . "." . getFileType($_FILES['files']['name'][$i]);
             imagegif($image, $this->_imgdir . '/' . $imagename);
             //销毁由url生成的图片
             imagedestroy($image);
         } else {
             $imagename = $_FILES['files']['name'][$i];
         }
         $backArr[$i] = array("msg" => "{$msg}", "imagename" => "{$imagename}");
     }
     return $backArr;
 }
开发者ID:suollk,项目名称:KLBSalary,代码行数:82,代码来源:formModel.class.php

示例10: deleteFile

function deleteFile($d, $del = true)
{
    $size = 0;
    $t = getFileType($d);
    if ($t == 't') {
        // For time lapse try to delete all from this batch
        $files = findLapseFiles($d);
        foreach ($files as $file) {
            $size += filesize_n($file);
            if ($del) {
                if (!unlink($file)) {
                    $debugString .= "F ";
                }
            }
        }
    } else {
        $tFile = dataFilename($d);
        if (file_exists(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}")) {
            $size += filesize_n(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}");
            if ($del) {
                unlink(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}");
            }
        }
        if ($t == 'v' && file_exists(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}.dat")) {
            $size += filesize_n(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}.dat");
            if ($del) {
                unlink(LBASE_DIR . '/' . MEDIA_PATH . "/{$tFile}.dat");
            }
        }
    }
    $size += filesize_n(LBASE_DIR . '/' . MEDIA_PATH . "/{$d}");
    if ($del) {
        unlink(LBASE_DIR . '/' . MEDIA_PATH . "/{$d}");
    }
    return $size / 1024;
}
开发者ID:zepspaiva,项目名称:RPi_Cam_Web_Interface,代码行数:36,代码来源:config.php

示例11: opendir

			<?php 
    $dirs = opendir($idir);
    ?>
			<?php 
    while (false !== ($f = readdir($dirs))) {
        ?>
			<?php 
        if (!is_file($idir . $f)) {
            continue;
        }
        ?>
			<?php 
        $fext = getExt($f);
        ?>
			<?php 
        $ftype = getFileType($fext);
        ?>
			

				<div class="imgbox" title="<?php 
        echo $f;
        ?>
">
					<div class="delbox"><a href="<?php 
        echo $g['s'];
        ?>
/?r=<?php 
        echo $r;
        ?>
&amp;m=<?php 
        echo $module;
开发者ID:hoya0704,项目名称:trevia.co.kr,代码行数:31,代码来源:main.php

示例12: drawFile

function drawFile($f, $ts, $sel)
{
    $fType = getFileType($f);
    $rFile = dataFilename($f);
    $fNumber = getFileIndex($f);
    $lapseCount = "";
    switch ($fType) {
        case 'v':
            $fIcon = 'video.png';
            break;
        case 't':
            $fIcon = 'timelapse.png';
            $lapseCount = '(' . count(findLapseFiles($f)) . ')';
            break;
        case 'i':
            $fIcon = 'image.png';
            break;
        default:
            $fIcon = 'image.png';
            break;
    }
    $duration = '';
    if (file_exists(MEDIA_PATH . "/{$rFile}")) {
        $fsz = round(filesize(MEDIA_PATH . "/{$rFile}") / 1024);
        $fModTime = filemtime(MEDIA_PATH . "/{$rFile}");
        if ($fType == 'v') {
            $duration = $fModTime - filemtime(MEDIA_PATH . "/{$f}") . 's';
        }
    } else {
        $fsz = 0;
        $fModTime = filemtime(MEDIA_PATH . "/{$f}");
    }
    $fDate = @date('Y-m-d', $fModTime);
    $fTime = @date('H:i:s', $fModTime);
    $fWidth = max($ts + 4, 140);
    echo "<fieldset class='fileicon' style='width:" . $fWidth . "px;'>";
    echo "<legend class='fileicon'>";
    echo "<button type='submit' name='delete1' value='{$f}' class='fileicondelete' style='background-image:url(delete.png);\n'></button>";
    echo "&nbsp;&nbsp;{$fNumber}&nbsp;";
    echo "<img src='{$fIcon}' style='width:24px'/>";
    echo "<input type='checkbox' name='check_list[]' {$sel} value='{$f}' style='float:right;'/>";
    echo "</legend>";
    if ($fsz > 0) {
        echo "{$fsz} Kb {$lapseCount} {$duration}";
    } else {
        echo 'Busy';
    }
    echo "<br>{$fDate}<br>{$fTime}<br>";
    if ($fsz > 0) {
        echo "<a title='{$rFile}' href='preview.php?preview={$f}'>";
    }
    echo "<img src='" . MEDIA_PATH . "/{$f}' style='width:" . $ts . "px'/>";
    if ($fsz > 0) {
        echo "</a>";
    }
    echo "</fieldset> ";
}
开发者ID:0legg,项目名称:RPi_Cam_Web_Interface,代码行数:57,代码来源:preview.php

示例13: number_format

            $fSize = @filesize($entry);
            $f["size"] = $fSize;
            $f["fullSize"] = number_format($fSize, 0, ".", ",");
            $f["niceSize"] = nicesize($fSize);
            $pi = pathinfo($entry);
            $f["type"] = $pi["extension"];
            $f["link"] = myEncode($path, $entry);
            if (in_array("cvsversion", $displayColumns)) {
                $f["cvsversion"] = getVersion($entry);
            }
        }
    }
    if (!$f["isBack"]) {
        $f["displayName"] = htmlentities(iTrunc($f["name"], $truncateLength));
    }
    $f["filetype"] = getFileType($f);
    $f["icon"] = getIcon($f["filetype"]);
    if ($useAutoThumbnails && $f["filetype"] == "image") {
        $f["thumbnail"] = "<a href=\"" . urldecode($f["link"]) . "\"><img src=\"" . $PHP_SELF . "?thumbnail=" . urlencode($path . $f["name"]) . "\" style=\"text-align: left;\" alt=\"\"/></a>";
    }
    $files[] = $f;
}
usort($files, "myCompare");
$pagingInEffect = $usePaging > 0 && count($files) > $usePaging;
if ($usePaging > 0) {
    $pageStart = $_GET["start"];
    if ($pageStart == "" || $pageStart < 0 || $pageStart > count($files)) {
        $pageStart = 0;
    }
    $pagingActualPage = floor($pageStart / $usePaging);
    $pagingNumberOfPages = ceil(count($files) / $usePaging);
开发者ID:stsquad,项目名称:CODEF,代码行数:31,代码来源:index.php

示例14: getThumbnails

function getThumbnails()
{
    global $sortOrder;
    global $showTypes;
    global $timeFilter, $timeFilterMax;
    $files = scandir(MEDIA_PATH, $sortOrder - 1);
    $thumbnails = array();
    $nowTime = time();
    foreach ($files as $file) {
        if ($file != '.' && $file != '..' && isThumbnail($file)) {
            if ($timeFilter == 1) {
                $include = true;
            } else {
                $timeD = $nowTime - filemtime(MEDIA_PATH . "/{$file}");
                if ($timeFilter == $timeFilterMax) {
                    $include = $timeD >= 86400 * ($timeFilter - 1);
                } else {
                    $include = $timeD >= 86400 * ($timeFilter - 2) && $timeD < ($timeFilter - 1) * 86400;
                }
            }
            if ($include) {
                $fType = getFileType($file);
                if ($showTypes == '1') {
                    $thumbnails[] = $file;
                } elseif ($showTypes == '2' && ($fType == 'i' || $fType == 't')) {
                    $thumbnails[] = $file;
                } elseif ($showTypes == '3' && $fType == 'v') {
                    $thumbnails[] = $file;
                }
            }
        }
    }
    return $thumbnails;
}
开发者ID:TurtleS0up03,项目名称:archive,代码行数:34,代码来源:preview.php

示例15: openFile

function openFile()
{
    global $sage_data_dir;
    $filename = $_REQUEST["filename"];
    if ($path = "") {
        return false;
    }
    $fspath = $sage_data_dir . $_SESSION["path"] . "/" . $filename;
    if (!file_exists($fspath)) {
        return false;
    }
    $filesize = filesize($fspath);
    $mime = getFileType($fspath);
    header("Content-Type: {$mime}");
    header("Content-Disposition: attachment; filename={$filename}");
    //header("Content-Length: $filesize ");
    readfile($fspath);
}
开发者ID:BackupTheBerlios,项目名称:sage,代码行数:18,代码来源:browser.php


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