我试图在数据库中上传照片,但是它没有更新,甚至没有上传。
这是我的php
if(isset($_POST['upload_photo'])){
// $profielfoto = $_POST['profielfoto_upload'];
$imagefileHandle = fopen($_FILES['profielfoto_upload']['name'], 'rb');
$imageData = fread($imagefileHandle, filesize($_FILES['profielfoto_upload']['tmp_name']));
fclose($imagefileHandle);
$query = $conn->prepare('UPDATE forum_inhoud SET profielfoto = :pf WHERE id = :id');
$query->execute([
':pf' => $imageData,
':id' => $_SESSION['user_id']
]);
$_SESSION['success'] = 'Uw gegevens zijn geupdate, U moet alleen opnieuw inloggen';
header("Location: ../../profile.php");
exit(0);
}
这是我的html
<form action="app/instellingen/crud_instellingen.php" method="post">
<div class="form-group row">
<div class="col-sm-12">
<input type="file" name="profielfoto_upload" class="form-control" ><!--accept="image/png,image/gif,image/jpeg,image/jpg"-->
</div>
</div>
<div class="form-group row text-center">
<div class="col-sm-12">
<button type="submit" name="upload_photo" class="btn btn-primary">Save Changes</button>
</div>
</div>
</form>
你们能帮我吗?