wszystko sobie sprawdzam na serwerku i w phpmyadmin to widzę co się dzieje
kod dodawania:
<form action="test.php" method="POST" ENCTYPE="multipart/form-data"> <form name="form" action="<?php echo $editFormAction; ?>" method="POST" ENCTYPE="multipart/form-data">
<input type="file" name="plik"/><br/> <input type="submit" value="Wyślij plik"/>
<input type="checkbox" name="aktywne" id="aktywne"> <input type="text" name="czas" id="czas"> <input type="hidden" name="MM_insert" value="form">
kod wykonywania
<?php
$max_rozmiar = 530*530;
if ($_FILES['plik']['size'] > $max_rozmiar) {
echo 'Błąd! Plik jest za duży!'; } else {
echo 'Plik zostałwysłany. Początkowa nazwa: '.$_FILES['plik']['name']; if (isset($_FILES['plik']['type'])) { echo 'Typ: '.$_FILES['plik']['type'].'<br/>'; }
$_SERVER['DOCUMENT_ROOT'].'/www.artdd.eu.xml.mysql/backgrounds/'.$_FILES['plik']['name']);
}
} else {
echo 'Błąd przy przesyłaniu danych!'; }
require_once('../Connections/mysqlartddxml.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) { $insertSQL = sprintf("INSERT INTO tlo (grafika_tlo, czas_wyswietlania, Aktywne) VALUES (%s, %s, %s)",
GetSQLValueString($_FILES['plik']['name'], "text"),
GetSQLValueString($_POST['czas'], "text"),
GetSQLValueString
(isset($_POST['aktywne']) ?
"true" : "", "defined","1","0"));
}
?>