Bonjour,
J'essaye d'enregistrer une image mais cela m'affiche un problème.
voici mon code:
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<body>
<form class="form-horizontal" method="post" enctype="multipart/form-data">
<input type="text" class="form-control" id="exampleInputName1" name="nom" placeholder="Entrer votre nom" value="<?php echo $d['prof'];?>">
<input type="file" id="exampleInputFile" name="image" >
<input type="submit" class="btn btn-primary" name="enr">
</form>
<?php
if(isset($_POST['enr'])){
$img_blob = addslashes($_FILES['image']['tmp_name']);
$img_blob = file_get_contents($_FILES['image']['tmp_name']);
$img_blob = base64_encode($img_blob);
$x = $bd->prepare("INSERT INTO user(nom,image) VALUES(:nom,:image) WHERE login= :login");
$x->execute([
'nom' => $_POST['nom'],
'image' => $img_blob,
'login' => $_SESSION['login']]);
} ?>
</body>
</html>