Guest User

Untitled

a guest
Feb 2nd, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. include "php.php";
  4.  
  5. $pripojeni = pripojeni();
  6.  
  7. if (isset($_POST["submit"])) {
  8.     $imagesCount = count($_FILES['image']['name']);
  9.     for ($i = 0; $i < $imagesCount; $i++) {
  10.         if (move_uploaded_file($_FILES['image']['tmp_name'][$i], 'galerie/' . $_FILES['image']['name'][$i]))
  11.             echo ('nahráno');
  12.         else
  13.             echo ('chyba');
  14.     }
  15.     $Nadpis = $_POST["Nadpis"];
  16.     $Text   = $_POST["Text"];
  17.     //$Id     = $_SESSION["Id"];
  18.     $Obr    = $_POST["image"];
  19.     $Dotaz  = $pripojeni->prepare("INSERT INTO `clanek`(`Id_uzivatele`,`Nadpis`, `Txt`, `Obr`) VALUES (?,?,?,?)");
  20.     var_dump($Dotaz);
  21.     $Dotaz->bind_param("isss", $Id, $Nadpis, $Text, $Obr);
  22.     $Dotaz->execute();
  23. }
  24. ?>
  25. <form method=POST class=clanek>Nadpis:<input type=text name=Nadpis>
  26. Text: <textarea name=Text cols=30 rows=10></textarea>
  27. Obr: <input type=file multiple= size=26 name=image[]>
  28. <input type=submit name=submit value=odeslat>
  29. </form>
Advertisement
Add Comment
Please, Sign In to add comment