I'm creating a form in html which will run php file and upload image and text in database.My html is directing perfectly to php but the uploading process not working.Everytime the submit button pressed,the php file show not working.
My Html Code :
<form name="f1" method="post" action="php/Savent.php"
enctype="application/x-www-form-urlencoded">
<fieldset>
<legend name = "addev" align="right"><b>Detail</b></legend>
<table width="100%">
<tr align="center">
<th>Choose Image : </th>
<td><input type="file" name="image"/></td>
</tr>
<tr>
<td colspan="2"><br/></td>
</tr>
<tr align="center">
<th>Description : </th>
<td><textarea name="desc" rows="6" cols="30" style="resize:
none"></textarea></td>
</tr>
<tr>
<td colspan="2"><br/></td>
</tr>
<tr align="center">
<td colspan="2" align="center"><input name="submit"
type="submit" value="Submit"/> <input type="reset"
value="Reset"/></td>
</tr>
<tr>
<td colspan="2"><br/></td>
</tr>
</table>
Php Code :
<?php
if(isset($_POST["submit"])){
mysqli_connect("sql303.unaux.com","unaux_20153623","testin");
mysqli_select_db("unaux_20153623_dummy");
$imageName = mysqli_real_escape_string($_FILES["image"]["name"]);
$imageData =
mysqli_real_escape_string(file_get_contents($_FILES["image"]
["tmp_name"]));
$imageType = mysqli_real_escape_string($_FILES["image"]["type"]);
$desc = mysqli_real_escape_string($_POST["desc"]);
if (substr($imageType,0,5) == "image"){
echo "Working";
mysqli_query("INSERT INTO 'events'
VALUES('','$imageName','$imageData','$desc')");
echo "Saved Succesfully";
}
else{
echo "Not Working";
}
}
?>