本文整理汇总了PHP中JUDownloadHelper::getPostMaxSize方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getPostMaxSize方法的具体用法?PHP JUDownloadHelper::getPostMaxSize怎么用?PHP JUDownloadHelper::getPostMaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::getPostMaxSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadFileScript
public function uploadFileScript($doc_id = null, $selector = "#judl-files")
{
$params = JUDownloadHelper::getParams(null, $doc_id);
$max_upload_file_size = (int) $params->get("max_upload_file_size", 10) * 1024 * 1024;
$post_max_size = JUDownloadHelper::getPostMaxSize();
if ($max_upload_file_size < $post_max_size) {
$runtimes = 'html5,flash,silverlight,html4';
} else {
$runtimes = 'html5,silverlight,html4';
}
$chunk_size = JUDownloadHelper::getPostMaxSize() - 4000;
$max_upload_files = 1;
$legal_upload_extensions = $params->get("legal_upload_extensions", "bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,zip,rar");
$legal_upload_extensions = str_replace("\n", ",", trim($legal_upload_extensions));
$check_mime_uploaded_file = (int) $params->get("check_mime_uploaded_file", 0);
$legal_mime_types = $check_mime_uploaded_file ? $params->get("legal_mime_types", 'image/jpeg,image/gif,image/png,image/bmp,application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/zip,application/zip') : "";
if ($legal_mime_types) {
$legal_mime_types = str_replace("\n", ",", trim($legal_mime_types));
}
$requiredFile = $params->get("document_require_file", 1);
$time = time();
$secret = JFactory::getConfig()->get('secret');
$code = md5($time . $secret);
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$script = '
jQuery(document).ready(function ($) {
var options = {
doc_id : ' . (int) $doc_id . ',
juri_root : "' . JUri::root() . '",
juri_base : "' . JUri::base() . '",
runtimes : "' . $runtimes . '",
chunk_size : "' . $chunk_size . '",
max_upload_file_size : ' . $max_upload_file_size . ',
max_upload_files : ' . $max_upload_files . ',
extensions : "' . $legal_upload_extensions . '",
mime_types : "' . $legal_mime_types . '",
is_required : ' . (int) $requiredFile . ',
time : ' . $time . ',
code : "' . $code . '",
is_site : ' . (int) $app->isSite() . '
};
$("' . $selector . '").files(options);
});';
$document->addScriptDeclaration($script);
}