當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ajax::file_download方法代碼示例

本文整理匯總了PHP中ajax::file_download方法的典型用法代碼示例。如果您正苦於以下問題:PHP ajax::file_download方法的具體用法?PHP ajax::file_download怎麽用?PHP ajax::file_download使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ajax的用法示例。


在下文中一共展示了ajax::file_download方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ltrim

    $field = "filedata";
} else {
    $field = ltrim($_REQUEST["field"], "_");
}
if (empty($_REQUEST["folder"]) and !empty($_REQUEST["folder2"])) {
    $_REQUEST["folder"] = $_REQUEST["folder2"];
}
if (empty($_REQUEST["view"]) and !empty($_REQUEST["view2"])) {
    $_REQUEST["view"] = $_REQUEST["view2"];
}
if (empty($_REQUEST["folder"])) {
    header("Content-Length: 0");
    exit;
}
$folder = folder_from_path($_REQUEST["folder"]);
$row_filename = ajax::file_download($folder, @$_REQUEST["view"], @$_REQUEST["item"], $field, @$_REQUEST["subitem"], false);
$filename = modify::basename($row_filename);
$ext = substr(modify::getfileext($filename), 0, 3);
if (in_array($ext, $bad_extensions)) {
    sys_error(trans("{t}Access to this file has been denied.{/t} ({t}this file extension is not allowed{/t})"), "403 Forbidden");
}
if ($dispo == "inline" and !in_array($ext, $inline_extensions)) {
    $dispo = "attachment";
}
$modified = filemtime($row_filename);
$etag = '"' . md5($row_filename . $modified) . '"';
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modified) . " GMT");
header("ETag: {$etag}");
if (!empty($_SERVER["HTTP_IF_NONE_MATCH"]) and $etag == stripslashes($_SERVER["HTTP_IF_NONE_MATCH"]) and !DEBUG) {
    header("HTTP/1.0 304 Not Modified");
    exit;
開發者ID:drognisep,項目名稱:Simple-Groupware,代碼行數:31,代碼來源:download.php

示例2: getfile_url

 static function getfile_url($url)
 {
     $filename = self::_url_getfilename($url);
     list($target, $filename) = sys_build_filename($filename);
     dirs_checkdir($target);
     $target .= $_SESSION["username"] . "__" . $filename;
     if (sys_is_internal_url($url)) {
         $vars = array();
         parse_str(parse_url($url, PHP_URL_QUERY), $vars);
         if (!empty($vars["folder2"]) and !empty($vars["item"]) and !empty($vars["field"])) {
             $source = ajax::file_download($vars["folder2"], @$vars["view2"], $vars["item"], $vars["field"], @$vars["subitem"], false);
             if (file_exists($source) and copy($source, $target)) {
                 return $target;
             }
         }
     }
     if ($f_in = @fopen($url, "rb") and $f_out = fopen($target, "wb")) {
         while (!feof($f_in)) {
             fwrite($f_out, fread($f_in, 8192));
         }
         fclose($f_out);
         fclose($f_in);
         return $target;
     }
     return "";
 }
開發者ID:drognisep,項目名稱:Simple-Groupware,代碼行數:26,代碼來源:sgsml.php


注:本文中的ajax::file_download方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。