コード例 #1
0
<?php

include_once "../Model/Destinos.php";
include_once "conectar.php";
include_once "../Model/Lugares.php";
// agrega destinos a la base de datos
$url = "../img/";
//////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['pais'], $_POST['lugar'], $_POST['descrip'], $_POST['precio'])) {
    $pais = $_POST['pais'];
    $nombre_des = $_POST['lugar'];
    $descri = $_POST['descrip'];
    $precio = $_POST['precio'];
    $destino = new Destinos();
    $response = $destino->Set_destino($nombre_des, $pais, $precio, $descri);
    $data['last_cod_id'] = $response['last_cod_id'];
    if (isset($response['exito'])) {
        $array_nombre = array();
        $err = array();
        if (isset($_FILES['inp_file'])) {
            if (count($_FILES['inp_file'] > 1)) {
                foreach ($_FILES as $key => $files) {
                    $cont_caract = strlen($files['name']);
                    if ($cont_caract > 40) {
                        $nomb = substr($files['name'], 0, 35);
                    } else {
                        $nomb = $files['name'];
                    }
                    try {
                        move_uploaded_file($files['tmp_name'], $url . time() . $nomb);
                        array_push($array_nombre, time() . $nomb);