示例#1
0
}
$session->check_session();
$page = $session->get_session_param(_SESSION_PARAM_PAGE);
if (strlen($page) == 0) {
    $session->fermer_session();
    header("HTTP/1.0 404 Not Found");
    exit;
}
// Quoi qu'il en soit on vide le dossier d'upload
$upload_path = getcwd() . "/" . _UPLOAD_DOSSIER;
@unlink($upload_path . _UPLOAD_FICHIER . "." . _UPLOAD_EXTENSION_JPG);
@unlink($upload_path . _UPLOAD_FICHIER . "." . _UPLOAD_EXTENSION_PNG);
@unlink($upload_path . _UPLOAD_FICHIER . "." . _UPLOAD_EXTENSION_GIF);
$result = _UPLOAD_UNKNOWN_ERROR;
if (isset($_FILES["upload_image"])) {
    $result = verif_upload($_FILES["upload_image"]);
    if ($result == _UPLOAD_NO_ERROR) {
        $result = verif_image($_FILES["upload_image"]);
    }
    if ($result == _UPLOAD_NO_ERROR) {
        $file_name = $_FILES["upload_image"]["name"];
        $tmp_name = $_FILES["upload_image"]["tmp_name"];
        $extension = get_extension($file_name);
        $new_name = _UPLOAD_FICHIER . "." . $extension;
        $ret = @move_uploaded_file($tmp_name, $upload_path . $new_name);
        if ($ret) {
            $result = $new_name;
        }
    }
}
echo $result;
示例#2
0
    header("Location: " . _SESSION_URL_FERMETURE);
    exit;
}
$session->check_session();
$page = $session->get_session_param(_SESSION_PARAM_PAGE);
if (strlen($page) == 0) {
    $session->fermer_session();
    header("HTTP/1.0 404 Not Found");
    exit;
}
// Quoi qu'il en soit on vide le dossier d'upload
$upload_path = getcwd() . "/" . _UPLOAD_DOSSIER;
@unlink($upload_path . _UPLOAD_FICHIER . "." . _UPLOAD_EXTENSION_PJ);
$result = _UPLOAD_UNKNOWN_ERROR;
if (isset($_FILES["upload_pj"])) {
    $result = verif_upload($_FILES["upload_pj"]);
    if ($result == _UPLOAD_NO_ERROR) {
        $result = verif_pj($_FILES["upload_pj"]);
    }
    if ($result == _UPLOAD_NO_ERROR) {
        $file_name = $_FILES["upload_pj"]["name"];
        $tmp_name = $_FILES["upload_pj"]["tmp_name"];
        $extension = get_extension($file_name);
        $taille = (int) (@filesize($tmp_name) / 1024);
        $new_name = _UPLOAD_FICHIER . "_" . $taille . "." . $extension;
        $ret = @move_uploaded_file($tmp_name, $upload_path . $new_name);
        if ($ret) {
            $result = $new_name;
        }
    }
}