本文整理汇总了PHP中FileUpload::init方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::init方法的具体用法?PHP FileUpload::init怎么用?PHP FileUpload::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editeur_upload
function editeur_upload()
{
global $apli, $pcfile, $pcfile_size, $pcfile_name, $pcfile_type;
global $MAX_FILE_SIZE, $MAX_FILE_SIZE_TOTAL, $mimetypes, $mimetype_default, $rep_upload_editeur, $path_upload_editeur;
include "modules/upload/include/fileupload.php";
// Récupération des valeurs de PCFILE
global $HTTP_POST_FILES, $_FILES;
if (!empty($HTTP_POST_FILES)) {
$fic = $HTTP_POST_FILES;
} else {
$fic = $_FILES;
}
$pcfile_name = $fic['pcfile']['name'];
$pcfile_type = $fic['pcfile']['type'];
$pcfile_size = $fic['pcfile']['size'];
$pcfile = $fic['pcfile']['tmp_name'];
$fu = new FileUpload();
$fu->init($rep_upload_editeur, '', $apli);
$attachments = $fu->getUploadedFiles('', '');
if (is_array($attachments)) {
$att_count = $attachments['att_count'];
$att_size = $attachments['att_size'];
if (is_array($pcfile_name)) {
reset($pcfile_name);
$names = implode(', ', $pcfile_name);
$pcfile_name = $names;
}
return $path_upload_editeur . $pcfile_name;
} else {
return '';
}
}
示例2: forum_upload
function forum_upload()
{
global $apli, $IdPost, $IdForum, $IdTopic, $pcfile, $pcfile_size, $pcfile_name, $pcfile_type, $att_count, $att_size, $total_att_count, $total_att_size;
global $MAX_FILE_SIZE, $MAX_FILE_SIZE_TOTAL, $mimetypes, $mimetype_default, $upload_table, $rep_upload_forum;
// mine......
list($sum) = sql_fetch_row(sql_query("SELECT SUM(att_size ) FROM {$upload_table} WHERE apli = '{$apli}' && post_id = '{$IdPost}'"));
// gestion du quota de place d'un post
if ($MAX_FILE_SIZE_TOTAL - $sum < $MAX_FILE_SIZE) {
$MAX_FILE_SIZE = $MAX_FILE_SIZE_TOTAL - $sum;
}
include "modules/upload/include/fileupload.php";
// RÈcupÈration des valeurs de PCFILE
global $HTTP_POST_FILES, $_FILES;
if (!empty($HTTP_POST_FILES)) {
$fic = $HTTP_POST_FILES;
} else {
$fic = $_FILES;
}
$pcfile_name = $fic['pcfile']['name'];
$pcfile_type = $fic['pcfile']['type'];
$pcfile_size = $fic['pcfile']['size'];
$pcfile = $fic['pcfile']['tmp_name'];
$fu = new FileUpload();
$fu->init($rep_upload_forum, $IdForum, $apli);
$att_count = 0;
$att_size = 0;
$total_att_count = 0;
$total_att_size = 0;
$attachments = $fu->getUploadedFiles($IdPost, $IdTopic);
if (is_array($attachments)) {
$att_count = $attachments['att_count'];
$att_size = $attachments['att_size'];
if (is_array($pcfile_name)) {
reset($pcfile_name);
$names = implode(', ', $pcfile_name);
$pcfile_name = $names;
}
$pcfile_size = $att_size;
$thanks_msg .= '<div class="alert alert-success" role="alert">' . str_replace('{NAME}', '<strong>' . $pcfile_name . '</strong>', str_replace('{SIZE}', $pcfile_size, upload_translate("Fichier {NAME} bien reçu ({SIZE} octets transférés)"))) . '</div>';
$total_att_count += $att_count;
$total_att_size += $att_size;
}
return $thanks_msg;
}