Beispiel #1
0
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 '';
    }
}
Beispiel #2
0
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;
}