12345678910111213141516171819202122232425262728 |
- <?php
- include("conectar.php");
- $query_select = "SELECT * from articulos";
-
- //informacion de clientes
- $Titulo = mysqli_real_escape_string($dbconnection, $_POST['Titulo'] );
- $Fecha = mysqli_real_escape_string($dbconnection, $_POST['Fecha'] );
- $Tipo = mysqli_real_escape_string($dbconnection , $_POST['Tipo'] );
- $file = $_FILES['file'];
- $file_tmp_name = $_FILES['file']['tmp_name'];
- $filename = $_FILES['file']['name'];
- $file_ext = explode('.',$filename);
- $filename = strtolower(end($file_ext));
- $location = "Files-API/articles/".$filename;
- move_uploaded_file($file_tmp_name ,$location);
- //query to insert articulo
- $query_insert0 = "insert into articulos (Titulo_articulo, Tipo_articulo, Fecha_articulo ,Texto_articulo) values('$Titulo','$Tipo','$Fecha','$file')";
-
- try{
- $result = mysqli_query($dbconnection,$query_insert0);
- }
- catch(Exception $ex){
- die("No pude conectar a la base de datos: " . $ex->getMessage());
- }
- if($result){
- header("Location:index.php");
- }
- ?>
|