I’m still confuse if I need to save my image in binary form inside my database or I’ll just save it in a folder and save the name of my image of my database. For now I’ll stick to save the name of my image.
Here is my code:
<?php
include'../connection/connect-db.php';
echo $id = $_GET['ID'];
$uploaddir = '../upload/';
$file = $uploaddir ."student_".basename($_FILES['uploadfile']['name']);
$file_name = "student_".$_FILES['uploadfile']['name'];
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file))
{
$query = mysql_query("UPDATE tbl_student
SET stud_Image= '$file_name'
WHERE id = '$id'" ) or die (mysql_error());
echo "success";
} else {
echo "error";
}
?>
I managed to save the image in a folder. My problem is I can’t save the name in my database.