díky ježiš, už jsme ais přepracovaný...
taky jsme is uvědomil, že to chci dat do stejného řádku, teĎ se mi to ukládalo do dalšího, takže to vypadá takto:
<?php
if (isset($_POST['go'])) {
$text = stripslashes(htmlspecialchars(trim($_POST['editor1'])));
$author = $_POST['author'];
require_once "../include/db.php";
mysql_query("INSERT INTO `events` (`text`,`author`) VALUES ('$text','$author')");
$dotaz = mysql_query("SELECT * FROM `events` WHERE `text` = '$text' ORDER BY `id` DESC LIMIT 1");
while ($vypis = mysql_fetch_array($dotaz)) {
$id = $vypis['id'];
}
$dir = "../img/".$id;
if (!file_exists($dir)) {
mkdir($dir, 0777);
} // po sem je to určitě dobře
$cesta = "../img/".$id;
//$povoleni = array('jpg', 'jpeg', 'png', 'gif'); // nepotřebné
$jpg1 = ($_FILES['jpg1']['name']);
$jpg2 = ($_FILES['jpg2']['name']);
$jpg3 = ($_FILES['jpg3']['name']);
include "../include/prevodni-tabulka.php";
$jpg1 = strtr($jpg1, $prevodni_tabulka);
$jpg2 = strtr($jpg2, $prevodni_tabulka);
$jpg3 = strtr($jpg3, $prevodni_tabulka);
require_once "../include/db.php";
mysql_query("UPDATE `d77216_gusto`.`events` SET `jpg1` = '$jpg1', `jpg2` = '$jpg2', `jpg3` = '$jpg3' WHERE `id` = '$id'");
if (move_uploaded_file($jpg1, $cesta)) {
}
if (move_uploaded_file($jpg2, $cesta)) {
}
if (move_uploaded_file($jpg3, $cesta)) {
}
header("Location: ".$_SERVER['SERVER_ROOT']."http://www.restaurantgusto.cz/akce.php");
}
header("Location: ".$_SERVER['SERVER_ROOT']."http://www.restaurantgusto.cz/akce.php");
?>
Teď už se mi jméno souboru (tedy cesta k němu) uloží, ale furt se mi soubor nenahraje, proč?chyba podle mě bude tady:
$jpg1 = ($_FILES['jpg1']['name']);
$jpg2 = ($_FILES['jpg2']['name']);
$jpg3 = ($_FILES['jpg3']['name']);
nebo tady<form method=\"POST\" action=\"scripty/akce.php\" enctype=\"multipart/form-data\">