} } if (isset($_FILES['picture'])) { FB::log($_POST, 'POST'); FB::log($_FILES, 'FILES'); $imagesize = getimagesize($_FILES['picture']['tmp_name']); FB::log($imagesize, 'label'); if (!in_array($_FILES['picture']['type'], array('image/jpeg', 'image/jpg', 'image/pjpeg'))) { $error = 'Votre fichier doit être au format jpeg.'; } elseif ($imagesize[0] / $imagesize[1] != 740 / 340) { $error = 'Les dimensions de votre image doivent être de 740x340 ou bien d\'un ratio équivalent.'; } else { require 'classes/uploader.class.php'; try { $upload = new Uploader($_FILES['picture']); $upload->setDstPath(getFtpAircraftsRoot() . '/' . $_POST['rep'] . '/'); $upload->upload(); $confirm = "L'image " . $_FILES['picture']['name'] . " a été ajoutée"; } catch (UploaderException $e) { $error = $e->getMessage(); } } } // Tous les aircrats $aircrafts = $db->getAllProducts(); foreach ($aircrafts as $aircraft) { $aircraft->images = array(); if (is_dir(getFtpAircraftsRoot() . '/' . $aircraft->rep . '/')) { $aircraft->images = readdir_recursive(getFtpAircraftsRoot() . '/' . $aircraft->rep . '/', array('jpg')); } }
FB::log($_POST, 'POST'); FB::log($_FILES, 'FILES'); for ($i = 0; $i < count($_FILES['brochures']['name']); $i++) { $imagesize = getimagesize($_FILES['brochures']['tmp_name'][$i]); if (!in_array($_FILES['brochures']['type'][$i], array('application/pdf', 'application/x-pdf', 'application/vnd.pdf', 'text/pdf'))) { $error = 'Votre fichier doit être au format pdf, mime fourni : ' . $_FILES['brochures']['type'][$i]; } } if (!isset($error)) { $confirm = array(); require 'classes/uploader.class.php'; try { for ($i = 0; $i < count($_FILES['brochures']['name']); $i++) { $tmpfile = array('name' => $_FILES['brochures']['name'][$i], 'type' => $_FILES['brochures']['type'][$i], 'tmp_name' => $_FILES['brochures']['tmp_name'][$i], 'error' => $_FILES['brochures']['error'][$i], 'size' => $_FILES['brochures']['size'][$i]); $upload = new Uploader($tmpfile); $upload->setDstPath(getFtpRoot() . '/upload/'); $upload->upload(); $confirm[] = "Le document " . $_FILES['brochures']['name'][$i] . " a été uploadé."; } } catch (UploaderException $e) { $error = $e->getMessage(); } } } // Ajouter un accès à un document if ($httpQuery->has('indexForm', 'active')) { $user_key = keygen(); $id_avion = false; $submitName = 'activate_access'; $submitValue = 'Activer'; $name = '';