Hi, need help with inputing images to mysql. I read lots of previous thread about it but couldn't find the proper answer. this is code for my basic form:
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>" enctype="multipart/form-data">
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td>tytul</td>
<td><label>
<input type="text" name="tytul" id="tytul" />
</label></td>
</tr>
<tr>
<td>opis</td>
<td><textarea name="opis" id="opis" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td>telefon</td>
<td><label>
<input type="text" name="telefon" id="telefon" />
</label></td>
</tr>
<tr>
<td>email</td>
<td><label>
<input type="text" name="email" id="email" />
</label></td>
</tr>
<tr>
<td>image</td>
<td><label>
<input type="file" name="image" id="image" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="submit" id="submit" value="WyĆlij" />
</label></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
this is my insert code:
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO oferujeP (tytul, opis, telefon, email, image) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['tytul'], "text"),
GetSQLValueString($_POST['opis'], "text"),
GetSQLValueString($_POST['telefon'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['image'], "text"));
mysql_select_db($database_hull, $hull);
$Result1 = mysql_query($insertSQL, $hull) or die(mysql_error());
$insertGoTo = "ogloszenia1.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
and after submitting - "Column 'image' cannot be null" that column is set as BLOB what did i wrong? - plzzz HELP