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


PHP FileUpload::init方法代码示例

本文整理汇总了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 '';
    }
}
开发者ID:npds,项目名称:npds_dune,代码行数:32,代码来源:upload_editeur2.php

示例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;
}
开发者ID:npds,项目名称:npds_dune,代码行数:44,代码来源:upload_forum2.php


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