1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| /**
* Add picture in galery
*
*/
function addFilesGalery(){
if (isset($_FILES['uploadf'])) {
if ($_FILES['uploadf']['error'] == UPLOAD_ERR_OK){
if (!file_exists('../../../galery/'.$this->allcategory.'/'.$_FILES['uploadf']['name'])){
if($this->image_valid($_FILES['uploadf']['type']) === false)
{
$this->smarty->assign('msg','Mauvais format d\'image (gif,png,jpeg uniquement)');
$this->smarty->display('backend/filemanager/send-error.tpl');
}else{
if(@chmod($_FILES["uploadf"]["tmp_name"],0777)){
if(is_uploaded_file($_FILES["uploadf"]["tmp_name"])){
$source = $_FILES['uploadf']['tmp_name'];
$cible = '../../../galery/'.$this->allcategory.'/'.$this->replaceBadFormat($_FILES["uploadf"]["name"]);
/*if ($this->imgSizeMax($source) == false) {
$this->smarty->assign('msg','La taille maximum excéde');
$this->smarty->display('backend/filemanager/send-error.tpl');
}else{*/
if (isset($this->cats)) {
if (@move_uploaded_file($source, $cible)) {
$add = new DbAdminLoadGalery();
$add->addDbPictures();
$this->smarty->assign('msg','Le fichier à été ajouté');
$this->smarty->display('backend/filemanager/send.tpl');
}else{
$this->smarty->assign('msg','Erreur de fichier temporaire');
$this->smarty->display('backend/filemanager/send-error.tpl');
}
}
// }
}else{
$this->smarty->assign('msg','<div class="msg">Erreur d\'écriture du disque</div>');
$this->smarty->display('backend/filemanager/send-error.tpl');
}
}
}
}else{
$this->smarty->assign('msg','<div class="msg">Le fichier existe déjà</div>');
$this->smarty->display('backend/filemanager/send-error.tpl');
}
}elseif ($_FILES['uploadf']['error'] == UPLOAD_ERR_CANT_WRITE){
$this->smarty->assign('msg','Erreur d\'écriture du disque');
$this->smarty->display('backend/filemanager/send-error.tpl');
}
elseif ($_FILES['uploadf']['error'] == UPLOAD_ERR_NO_FILE){
$this->smarty->assign('msg','Aucun fichier');
$this->smarty->display('backend/filemanager/send-empty.tpl');
}elseif ($_FILES['uploadf']['error'] == UPLOAD_ERR_INI_SIZE){
$this->smarty->assign('msg','Le fichier est trop grand');
$this->smarty->display('backend/filemanager/send-error.tpl');
}elseif ($_FILES['uploadf']['error'] == UPLOAD_ERR_FORM_SIZE){
$this->smarty->assign('msg','Le fichier est trop grand <br /> Taille maximum 800x600');
$this->smarty->display('backend/filemanager/send-error.tpl');
}
}
} |
Partager