alpha_full/admin/agencement/favIcon/faviconUpload.php
2026-04-06 22:58:51 +02:00

61 lines
1.9 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
if ($_FILES["fileToUpload"]["tmp_name"]!='') {
$target_dir = "../Design/_favIcon/";
$targetExtension =['jpeg', 'jpg', 'png', 'svg', 'bmp', 'gif'];
$targetSize ='5242880'; //5 Mo
$largeurMax = 0;
$hauteurMax = 0;
$largeurMin = 0;
$hauteurMin = 0;
include ("./adminInclude/_fonctions/uploadGenerique.php");
// Check if $uploadOk is SET to 0 by an error
if ($uploadOk == 0) {$admMsg .= 'Fichier non chargé (' .$target_file. '). '; $admMsgClass='ko'; }
else {
$theFavIcon= $theFichier;
// ecrire la ligne head
switch ($imageFileType) {
case 'png':
$headMsg='<link rel="icon" type="image/png" href="' .$theFavIcon. '" />';
break;
case 'gif':
$headMsg='<link rel="icon" type="image/gif" href="' .$theFavIcon. '" />';
break;
case 'jpg':
$headMsg='<link rel="icon" type="image/jpg" href="' .$theFavIcon. '" />';
break;
case 'jpeg':
$headMsg='<link rel="icon" type="image/jpeg" href="' .$theFavIcon. '" />';
break;
case 'ico':
$headMsg='<link rel="shortcut icon" type="image/x-icon" href="' .$theFavIcon. '" />';
break;
default:
break;
}
$retour='';
// -----------------------------------------------------
// Ecriture du fichier favicon
// -----------------------------------------------------
$retour=file_put_contents('../../Design/_favIcon/favIcon' .$lgCourante. '.php',$headMsg);
if ($retour!='') {
$admMsg .= '<br>Le site a été mis à jour. ';
$admMsgClass='ok';
}
else {
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Désolé, il y a eu une erreur en chargeant votre fichier(' => $target_file], '');}
$uploadOk = 0;
$admMsgClass='ko';
}
}
}
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['upload' => 'Non'], '');}
?>