I am trying to upload an image through form into mysql this is my form
<form action="" method="POST" id="formSettingStoreLogo">
<div>
<p>Put a logo </p><br>
<input type="file" name="logo" />
<input type="submit" name="submitLogo" id="submitLogo" value="Upload" />
</div>
</form>
This is the jQuery I have written
$(document).on('submit', '#formSettingStoreLogo', function(e)
{
e.preventDefault();
$.ajax({
type: 'POST',
url: logoupload.php,
data: $("#formSettingStoreLogo").serialize(),
success: function(data)
{
}
});
};
and logoupload.php
<?php
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start();
$storeid = $_SESSION['storeid'];
$stmt = $mysqli->prepare("UPDATE store_details SET store_logo=? WHERE store_id =?");
$stmt->bind_param('bi',$_POST['logo'],$storeid);
$stmt->execute();
$stmt->store_result();
?>
<p>Uploading logo of store</p>
And
blob is the data type of store_logo column
Form posts data but doesn't insert into database.