I've created a custom table on database and I need to upload image from my template page member. In this page I've done all the codings. I'm able to insert data but stuck on the image insert. I can get the file name but unable to get the extension.
Here is my inserting code of my template file.
$tmpfile = explode(".", $_FILES['image']['name']);
$newfile = round(microtime(true)) . '.' . end($tmpfile);
move_uploaded_file($_FILES['image']['tmp_name'], ABSPATH . '/wp-content/themes/themename/inc/images/' . $newfile);
$sql = $wpdb->query($wpdb->prepare("INSERT INTO members(member_image) VALUES (%s)", $newfile));
The above code shows the field value without extension as:
Here is my html form field:
<form action="" method="post">
<input type="file" name="image" class="form-control">
</form>
All other text fields are inserted but only image can't be derived with extension. I can't figure out the problem. I've also tried by adding .jpg extension but it didn't work.