I’m trying to add images to folder and keep path in DB and I have no idea how to added to this code. This code is working fine, but not adding images into DB as a blob.
please help
[php]if(isset($_POST[‘submit’])){
$stmt = $connection->prepare("INSERT INTO advert (title, email, phone, place, options, name, lastname, message, kod , image, rodzaj, cena, ip, user) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param(“sssssssssbssss”, $title, $email, $phone, $place, $options, $name, $lastname, $message, $randomString, $file, $rodzaj, $cena, $ip, $user);
$file = addslashes(file_get_contents($_FILES["images"]["tmp_name"]));
$user=$_SESSION['login'];
$title=filter_var($_POST[‘title’], FILTER_SANITIZE_STRING);
$email=filter_var($_POST[‘email’], FILTER_SANITIZE_STRING);
$phone=filter_var($_POST[‘phone’], FILTER_SANITIZE_STRING);
$place=filter_var($_POST[‘place’], FILTER_SANITIZE_STRING);
$options=filter_var($_POST[‘options’], FILTER_SANITIZE_STRING);
$name=$_SESSION[‘login’];
$lastname=filter_var($_POST[‘lastname’], FILTER_SANITIZE_STRING);
$message=filter_var($_POST[‘message’], FILTER_SANITIZE_STRING);
$rodzaj=filter_var($_POST[‘optradio’], FILTER_SANITIZE_STRING);
$cena=filter_var($_POST[‘cena’], FILTER_SANITIZE_STRING);
$length = 10;
$randomString = substr(str_shuffle(“0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”), 0, $length);
$_SESSION[‘codes’]=$randomString;
$ip=$_SERVER[“REMOTE_ADDR”];
$stmt->execute();[/php]