Not able to upload.getting error Problem uploading image.
echo "That's not an image.";
else
{
if (!$insert = mysqli_query($db ,"INSERT INTO uploadimages (`Name`,`image`,`user_id` ) VALUES ('$image_name','$image',$user_id)"))
echo "Problem uploading image.";
else
http://jsfiddle.net/amibhop/ja9fpo5b/ More info on this link here-please click
=================================================
http://jsfiddle.net/amibhop/ja9fpo5b/
<form id="form" action="" method="post" enctype="multipart/form-data" name="a">
<table width="65%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#EFEFEF">
<input type= "file" name="image"><p>
<td height="243" colspan=3 valign="top">
<table width="100%" border=0 cellpadding="3">
<tr>
<td width="100%" align="left" class="desc"><span class="style5">
<input type="button" name="Add" value="Add" onclick="addRow();"/>
<input name="submit" type="button" id="submit" value="Delete" onclick="deleteRow1('tblSample1');" />
</span></td>
</tr>
<tr>
<td align="left" class="desc"> <table id = "tblSample1" >
</table>
<input type="hidden" name="tblid" /><input type="hidden" name="cid" value="<?php echo $_REQUEST['id']; ?>" /></td>
</tr>
<tr bgcolor="white">
<td height="28" colspan="3" align="center"><div align="center">
<input type="submit" name="submit2" value="Save" class="button1" />
</div></td>
</tr>
</table></td></tr>
</table>
</form>
</body>
<?php
//connect to database
include('1.php');
include("db.php");
if(isset($_POST['submit2']))
{
$user_id=$_POST['cid'];
// file properties
$file = $_FILES["image"]["tmp_name"];
if (!isset($file))
echo "Please select an image.";
else
{
$image =addslashes(file_get_contents($_FILES["image"]["tmp_name"]));
$image_name = addslashes($_FILES["image"]["name"]);
$image_size = getimagesize($_FILES["image"]["tmp_name"]);
if ($image_size==FALSE)
echo "That's not an image.";
else
{
if (!$insert = mysqli_query($db ,"INSERT INTO uploadimages (`Name`,`image`,`user_id` ) VALUES ('".$image_name."','".$image."','".$user_id.")"))
echo "Problem uploading image.";
else
{
$lastID= mysqli_query($db ,'select * from uploadimages ORDER BY ID DESC LIMIT 1');
$las=mysqli_fetch_array($lastID) ;
$rea=$las['ID'];
echo "Image uploaded <p> Your image:</p>echo <img src='uploadphoto1.php'?ID='$rea'>";
}
}
}
}
?>
</html>
aDDING up more codes for clarification