Starting Vocational Training From 1-May-2024 Get Detail
<form role="form" name="" method="post" enctype="multipart/form-data" action="image-upload-do.php">
<div class="form-group">
<label>Gallery Image</label>
<input required name="image[]" multiple type="file" class="form-control">
</div>
<button type="submit" class="btn btn-success btn-sm">Submit </button>
</form>
create database image_upload;
create table image(id int primary key AUTO_INCREMENT,img_ext varchar(6));
$db = new PDO(mysql:host=localhost;dbname=image_upload;charset=utf8mb4, root, ); //database connection
foreach($_FILES[image][tmp_name] as $key => $tmp_name) {
$img_ext = pathinfo($file_name, PATHINFO_EXTENSION);
$q = $db-> query("insert into image(img_ext) values($img_ext)") or die("error");
$lastID = $db-> lastInsertId();
$imageNewName = $lastID.".".$img_ext; move_uploaded_file($file_tmp, "image/".$imageNewName);
}