// Nombre de extensión para Windows $extension = "image/pjpeg"; // === Seccion MySQL (a Eliminar)=============================================================================== // === Seccion Oracle (Nueva)=============================================================================== if ($tabla == "menu2") { $directorio = "./admin/menu2/"; $icon_file = $_FILES['ICONO']; if (count($icon_file) > 0) { UploadFile($directorio, $icon_file, $directorio); } $menu2 = new Menu2(); $menu2->Id = $_POST['ID_MENU2']; $menu2->Link = $_POST['LINK']; $menu2->Icono = $icon_file['name']; $menu2->Nombre = $_POST['NOMBRE']; $menu2->Persistir(); header("Location: menu2.php"); } function UploadFile($Target_dir, $fileArray, $directorio) { $name = $fileArray['name']; $type = $fileArray['type']; $tmp_name = $fileArray['tmp_name']; $size = $fileArray['size']; $error = $fileArray['error']; if ($error == 0) { if (strpos('| image/jpeg |', $type) > 0) { Resampling($tmp_name, $directorio, $name); } else { CustomError('El icono no corresponde a un formato de imagen aceptado (jpg,jpeg).', 'menu2.php'); }
$target_path = "admin/menu2/"; $target_path = $target_path . basename($_FILES['icono']['name']); if (move_uploaded_file($_FILES['icono']['tmp_name'], $target_path)) { $oMenus->Icono = $_FILES['icono']['name']; $anchoImagen = Resampling(basename($_FILES['icono']['name']), $target_path, $oMenus->Icono); chmod($target_path, 0666); } else { $oMenus->Icono = $_REQUEST["icono_viejo"]; } } else { $oMenus->Icono = $_REQUEST["icono_viejo"]; } if (isset($_REQUEST["borraicono"]) == true) { $oMenus->Icono = ""; } $oMenus->Persistir(); // Retorno echo "\n\t\t\t\t\t\t<script language='javascript'> \n\t\t\t\t\t\t\tvar ret = new Array('" . $oMenus->Nombre . "','" . $oMenus->Link . "'," . $_REQUEST["id_menu2"] . ",'" . $oMenus->Icono . "');\n\t\t\t\t\t\t\twindow.opener.recarga(ret);\n\t\t\t\t\t\t\twindow.close();\n\t\t\t\t\t\t</script>"; } else { $error = "Nombre invalido - caracteres no permitidos"; } } else { $error = "Archivo no valido !!!"; } } else { $error = "Archivo demasiado grande"; } } /* } else { $error_menu=1; }