mysql_select_db(DB_SCHEMA) or die("Non riesco a selezionare il database");
if (!isset($_GET["nome_sessione"])) {
    header("Location: login.php");
    exit;
}
$nome_sessione = $_GET["nome_sessione"];
$chiave_record = $_SESSION["chiave_record"];
$idTabella = $_SESSION["idTabella"];
$nome_file_originale = $_SESSION["nome_file_originale"];
//DEFINIZIONE CARTELLE / VALORI
$cartella_appoggio = CARTELLA_APPOGGIO_UPLOAD;
//recupero la cartella per l'upload
$cartella_upload = dimmi_cartella_upload($idTabella);
//e setto il percorso
$percorso_new = "../" . UPLOAD_FILE . "/" . $cartella_upload . "/";
crea_percorso($percorso_new);
$tipo_file = tipo_file($nome_file_originale);
//RECUPERO E SPOSTO LE IMMAGINI
//la thumb
$thumb_image_name = thumb_image_prefix . $nome_sessione . "." . $tipo_file;
$thumb_image_file = CARTELLA_APPOGGIO_UPLOAD . $thumb_image_name;
$thumb_image_name_nuovo = md5_file($thumb_image_file) . "_thumb." . $tipo_file;
$redim_image_name_nuovo = md5_file($thumb_image_file) . "." . $tipo_file;
copy($thumb_image_file, $percorso_new . $thumb_image_name_nuovo);
//e l'img a dimensione fissa
$redim_image_name = large_image_prefix . $nome_sessione . "." . $tipo_file;
if (is_file(CARTELLA_APPOGGIO_UPLOAD . $redim_image_name)) {
    $redim_image_file = CARTELLA_APPOGGIO_UPLOAD . $redim_image_name;
    copy($redim_image_file, $percorso_new . $redim_image_name_nuovo);
}
//cancello le img dalla cartella temporanea
Esempio n. 2
0
    // The prefix name to the thumb image
} else {
    $thumb_width = $arrayDimensioni[2];
    // Width of thumbnail image
    $thumb_height = $arrayDimensioni[3];
    // Height of thumbnail image
    $thumb_image_prefix = thumb_image_prefix;
    // The prefix name to the thumb image
}
$large_image_name = $large_image_prefix . $_SESSION['random_key'];
// New name of the large image (append the timestamp to the filename)
$thumb_image_name = $thumb_image_prefix . $_SESSION['random_key'];
// New name of the thumbnail image (append the timestamp to the filename)
//Create the upload directory with the right permissions if it doesn't exist
if (!is_dir($upload_dir)) {
    crea_percorso($upload_dir);
}
/*************si sta facendo l'upload dell'immagine grande***************/
if (isset($_POST["upload"])) {
    //Get the file information
    $userfile_name = $_FILES['image']['name'];
    $userfile_tmp = $_FILES['image']['tmp_name'];
    $userfile_size = $_FILES['image']['size'];
    $filename = basename($_FILES['image']['name']);
    $file_ext = substr($filename, strrpos($filename, '.') + 1);
    $_SESSION["nome_file_originale"] = $_FILES['image']['name'];
    //Only process if the file is a JPG and below the allowed limit
    if (!empty($_FILES["image"]) && $_FILES['image']['error'] == 0) {
        if (strtolower($file_ext) == "bmp" || $userfile_size > $max_file) {
            $error = "Le immagini di tipo <b>bmp</b> non possono essere caricate.";
        } else {