Uploading Image to MySql database

I have two php extension code one for form input & another for upload to MySql database management system. The form input code is as below:

denoted by “main.php”

Animal Information

&nbsp

Animal Information

Animal Name
Animal Description
Animal Photo

There is no error in this above code

The upload code is as below:

denoted by “storeinfo.php”

<?php ini_set('display_errors',1); error_reporting(E_ALL); $conn = mysql_connect("localhost","root",""); if(!$conn) { echo mysql_error(); } $db = mysql_select_db("imagestore",$conn); if(!$db) { echo mysql_error(); } $aname = $_POST['aname']; $adetails = $_POST['adetails']; $aphoto = addslahes(file_get_contents($_FILES['aphoto']['tmp_name'])); $image = getimagesize($_FILES['aphoto']['tmp_name"]);//to know about iamge type $imgtype = $image['mime']; $q="INSERT INTO animaldata VALUES('','$aname','$adetails','$aphoto','$imgtype')"; $r = mysql_query($q,$conn); if($r) { echo "Information stored successfully"; } else { echo mysql_error(); } ?>

When i fill up all Animal Information section and browse for image & click on summit button it display the error as below:

Parse error: syntax error, unexpected ‘mime’ (T_STRING), expecting ‘]’ in C:\xampp\htdocs\php\storeinfo.php on line 18

The image file size is 34.8KB. I have managed my PhpMyAdmin database name databaseimage with proper data & validity entries.

My Php version is 5.4.7, SQL version is 5.5.27. Why ‘mime’ is unexpected ? Please help me to solve it.

Sponsor our Newsletter | Privacy Policy | Terms of Service