The problem is that I upload a file to xampp. but I send it to the folder xampp / tmp / and not to the folder that I require as / htdocs / website / files
but the first file you sent if you upload it correctly. the others only makes me register in the database but I do not move the document to the correct folder.
example: I upload 1 file to the table files (which is empty) SQL statement is executed correctly. the file moves to / htdocs / website / files all OK. but when I raise the 2! make the Record in the correct table. but does not direct it to / htdocs / website / files if not a / xampp / tmp /
Code:
require("connect_db.php");
$titulo =$_POST['titulo'];
$subidopor =$_POST['subidopor'];
$codigo =$_POST['codigo'];
$descripcion =$_POST['descripcion'];
$nombre = $_FILES['archivo']['name'];
$tipo = $_FILES['archivo']['type'];
$tamanio = $_FILES['archivo']['size'];
$ruta = $_FILES['archivo']['tmp_name'];
$extension = pathinfo($nombre, PATHINFO_EXTENSION);
$extension = strtolower($extension);
$extension_correcta = ($extension == 'pdf' or $extension == 'docx' or $extension == 'xlsx');
if ($extension_correcta) {
$ruta_destino_archivo = "../archivos/"; //locacion del documento actual ../menu/subirarchivo.php
$archivo_ok = move_uploaded_file($nombre, $ruta_destino_archivo);
$guardar = $mysqli->query("insert into archivos (codigo,titulo,descripcion,tamanio,tipo,nombrearchivo,subidopor)VALUES('".$codigo."','".$titulo."','".$descripcion."','".$tamanio."','".$tipo."','".$nombre."','".$subidopor."')");
note: I work with PHP 7.2.3 and mariadb. probe in linux and windows.