How to upload an image in php mysql : <p>Hi iam trying to upload an image into database but it is inserting the tmp_name in the database.Can anyone help me this .</p>

<p>Here is my code</p>

<pre><code>&lt;?php
$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db("accountant", $connection);
$title=$_POST['blog_title'];
$description=$_POST['blog_description'];
$name=$_FILES["image"]["tmp_name"];
$type=$_FILES["image"]["type"];
$size=$_FILES["image"]["size"];
$temp=$_FILES["image"]["tmp_name"];
$error=$_FILES["image"]["error"];
if($error&gt;0)
die("error while uploading");
else
{
if($type == "image/png" || $type == "image/jpeg" ||$type == "image/jpg" || $type == "image/svg" || $size &gt;2000000)
{       
move_uploaded_file($temp,"upload/".$name);
$sql=mysql_query("INSERT INTO blogs(image,blog_title,blog_description)values('$name','$title','$description')");
echo "upload complete";
}
else
{
die("Format not allowed or file size too big!");
}
}
</code></pre>

<p>Iam trying to insert an image getting errors as </p>

<p>Warning: move_uploaded_file(upload/C:\xampp\tmp\php1908.tmp): failed to open stream: Invalid argument in C:\xampp\htdocs\accounting\admin\blogs.php on line 21</p>

<p>Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php1908.tmp' to 'upload/C:\xampp\tmp\php1908.tmp' </p>

<p>In database it is inserting as C:xampp    mpphp1908.tmp</p>
