Няма описание

12345678910111213141516171819202122232425262728
  1. <?php
  2. include("conectar.php");
  3. $query_select = "SELECT * from articulos";
  4. //informacion de clientes
  5. $Titulo = mysqli_real_escape_string($dbconnection, $_POST['Titulo'] );
  6. $Fecha = mysqli_real_escape_string($dbconnection, $_POST['Fecha'] );
  7. $Tipo = mysqli_real_escape_string($dbconnection , $_POST['Tipo'] );
  8. $file = $_FILES['file'];
  9. $file_tmp_name = $_FILES['file']['tmp_name'];
  10. $filename = $_FILES['file']['name'];
  11. $file_ext = explode('.',$filename);
  12. $filename = strtolower(end($file_ext));
  13. $location = "Files-API/articles/".$filename;
  14. move_uploaded_file($file_tmp_name ,$location);
  15. //query to insert articulo
  16. $query_insert0 = "insert into articulos (Titulo_articulo, Tipo_articulo, Fecha_articulo ,Texto_articulo) values('$Titulo','$Tipo','$Fecha','$file')";
  17. try{
  18. $result = mysqli_query($dbconnection,$query_insert0);
  19. }
  20. catch(Exception $ex){
  21. die("No pude conectar a la base de datos: " . $ex->getMessage());
  22. }
  23. if($result){
  24. header("Location:index.php");
  25. }
  26. ?>