This question is an exact duplicate of:
- php upload image with form not working 2 answers
I'm doing my project in bootstrap. there is an option for image upload in it, but i cant upload it in to my database.
boot.html:
<div class="form-group">
<label class="col-md-4 control-label" for="imgu">Upload images if / any</label>
<div class="col-md-4">
<input id="file" name="file" class="input-file" type="file">
</div>
php file:
<?php
$a=$_POST['cname'];
$b=$_POST['subject'];
$c=$_POST['cat'];
$d=$_POST['cmp'];
$e=$_POST['cweb'];
move_uploaded_file($_FILES["file"]["tmp_name"],$_FILES["file"]["name"]);
$x=$_FILES["file"]["name"];
mysql_connect("localhost","root","");
mysql_select_db("com");
$sql=mysql_query("insert into cd values('$a','$b','$c','$d','$e','$x')");
if(!$sql)
{
echo "not Inserted";
}
else
{
header("location:home.php");
}
?>
If there any mistakes with this code please do help me
</div>